private void Button_Click(object sender, RoutedEventArgs e) { if (Content) { App.Database.EraseContent(drug.ID); foreach (Ingredient i in list.SelectedItems) { DrugContent d = new DrugContent(); d.drugID = drug.ID; d.contentID = i.ID; App.Database.SaveDrugContentAsync(d); } frame.Navigate(new NewDrug(frame, drug)); } else { App.Database.EraseAllergy(customer.ID); foreach (Ingredient i in list.SelectedItems) { CustomerAllergy d = new CustomerAllergy(); d.AllergyID = i.ID; d.CustomerID = customer.ID; App.Database.AllergySave(d); } frame.Navigate(new NewPatient(frame, customer)); } }
public Task <int> AllergySave(CustomerAllergy item) { { if (item.ID != 0) { return(database.UpdateAsync(item)); } else { return(database.InsertAsync(item)); } } }