public void OnSaveClicked(object o, EventArgs e) { OccasionData occasionData = new OccasionData(); occasionData.Name = OccasionEntry.Text; occasionData.Date = OccasionDate.Date; occasionData.Yearly = Yearly.IsToggled; occasionData.NotificationDays = string.IsNullOrEmpty(Notification.Text) ? 0 : int.Parse(Notification.Text); Clear(); App.Database.SaveOccasion(occasionData); OccasionList.ItemsSource = App.Database.GetOccasions(); }
public int SaveOccasion(OccasionData occasion) { lock (locker) { if (occasion.Id != 0) { database.Update(occasion); return(occasion.Id); } else { return(database.Insert(occasion)); } } }