/// <summary> /// Removes the prescription group. /// </summary> /// <param name="selectedItems">The prescription group</param> public async void DeletePrescriptionGroup(object selectedItems) { try { PrescriptionGroup group = selectedItems as PrescriptionGroup; var count = group.Prescriptions.Count; await imsSvc.DeletePrescriptionGroupAsync(group.Prescriptions); AllPrescriptions.Remove(group); Prescriptions.Remove(group); } catch (Exception e) { MessengerInstance.Send(new ExceptionDialogMessage(e)); } }
/// <summary> /// Removes the prescription. /// </summary> /// <param name="selectedItem"></param> public async void DeletePrescription(object selectedItem) { try { Prescription item = selectedItem as Prescription; await imsSvc.DeletePrescriptionAsync(item); var group = AllPrescriptions.Single(grp => grp.TimeStamp == item.Schedule); if (group.Prescriptions.Count > 1) { AllPrescriptions.Single(grp => grp.TimeStamp == item.Schedule).Prescriptions.Remove(item); Prescriptions.Single(grp => grp.TimeStamp == item.Schedule).Prescriptions.Remove(item); } else { AllPrescriptions.Remove(group); Prescriptions.Remove(group); } } catch (Exception e) { MessengerInstance.Send(new ExceptionDialogMessage(e)); } }