private void SaveBellyEntrySample() { var newModel = new BellyEntryModel(); newModel.Vorname = "Filip"; newModel.Nachname = "Juric"; newModel.Gender = Gender.Male; newModel.Geburtsdatum = new DateTime(1996, 2, 7); newModel.IdentifyGuid = Guid.NewGuid(); newModel.CreatedAt = DateTime.Now; dbc.SaveBellyEntry(newModel); }
public void SaveBellyEntry(BellyEntryModel model) { try { // Open database (or create if not exits) using (var db = new LiteDatabase(appDbPath)) { var bellyentrys = db.GetCollection <BellyEntryModel>("bellyentrys"); bellyentrys.Upsert(model); bellyentrys.EnsureIndex(x => x.IdentifyGuid); } } catch (Exception e) { Toast.MakeText(Application.Context, e.ToString(), ToastLength.Long); } }