public async void AddItemToDb() { addDrugM.Drug.ImageUrl = ImageUrl; containingVm.startProcessing("Adding to database"); await Task.Run(() => { try { addDrugM.AddDrugToDb(); } catch (ArgumentException ex) { containingVm.ShowMessage(ex.Message); } catch (Exception ex) { containingVm.ShowMessage(ex.Message); } containingVm.finishProcessing("Success!"); GoBack(); }); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public async void UpdateInDb() { containingVm.startProcessing("Updating on database"); await Task.Run(() => { try { updatePhysicianM.UpdatePhysicianInDb(); containingVm.finishProcessing("Success!"); } catch (ArgumentException ex) { containingVm.ShowMessage(ex.Message); } catch (Exception ex) { containingVm.ShowMessage(ex.Message); } GoBack(); }); }
public async void RemoveItemFromDb(object selectedDrug) { containingShellVm.startProcessing("Removing drug"); Drug drug = selectedDrug as Drug; await Task.Run(() => { try { drugsManagementM.RemoveFromDb(drug); containingShellVm.finishProcessing("Drug removed"); } catch (ArgumentException e) { containingShellVm.ShowMessage(e.Message); } catch (Exception e) { containingShellVm.ShowMessage(e.Message); } }); Items.Remove(drug); }