public async void Delete() { if (CurrentVaccine?.FId != null) { var isDeleteAccepted = await StandardMessagesDisplay.DeleteDisplayMessage(CurrentVaccine.VaccineStatus); if (isDeleteAccepted) { var data = await DataService.Delete($"Vaccine/{Child?.Id}/{CurrentVaccine.FId}"); if (data == "Deleted") { VaccineList?.Remove(CurrentVaccine); CurrentVaccine = VaccineList.OrderBy(x => x.VaccinePeriod).LastOrDefault(); } else { StandardMessagesDisplay.CanceledDisplayMessage(); } } else { return; } } else { StandardMessagesDisplay.NoDataDisplayMessage(); } }
public async void Delete() { if (CurrentVaccine?.FId != null && CurrentVaccine.VaccinePeriod != null) { var isDeleteAccepted = await StandardMessagesDisplay.DeleteDisplayMessage(CurrentVaccine.VaccineStatus); if (isDeleteAccepted) { var deleteResponse = await DataService.Delete($"Vaccine/{Child?.Id}/{CurrentVaccine.FId}"); if (deleteResponse == "ConnectionError") { StandardMessagesDisplay.NoConnectionToast(); } else if (deleteResponse == "Error") { StandardMessagesDisplay.Error(); } else if (deleteResponse == "ErrorTracked") { StandardMessagesDisplay.ErrorTracked(); } else if (deleteResponse == "null") { StandardMessagesDisplay.ItemDeletedToast(); VaccineList?.Remove(CurrentVaccine); CurrentVaccine = new VaccineModel(); } } else { return; } } else { StandardMessagesDisplay.NoDataDisplayMessage(); } }