public ActionResult Delete(MedicationViewModel medicationViewModel, int medicalRecordId) { medicationViewModel.MedicalRecordEntryViewModel = medicalRecordEntryRepository.GetById(medicalRecordId).ToViewModel(); AddMedicalRecordToTempData(medicationViewModel.MedicalRecordEntryViewModel.Id); if (ModelState.IsValid) { AddMedicalRecordToTempData(medicationViewModel.MedicalRecordEntryViewModel.Id); medicationRepository.Delete(medicationViewModel.ToDomainModel()); return(RedirectToAction("Index", new { medicalRecordId = medicationViewModel.MedicalRecordEntryViewModel.Id })); } AddMedicalRecordToTempData(medicationViewModel.MedicalRecordEntryViewModel.Id); return(View(medicationViewModel)); }
public async Task <ResultDto <Guid, MedicationUpdateStatus> > Delete(Guid id) { try { var result = await _repository.Delete(id); return(result); } catch (DbUpdateConcurrencyException) { return(new ResultDto <Guid, MedicationUpdateStatus>(MedicationUpdateStatus.InternalServerError)); } catch (Exception ex) { return(new ResultDto <Guid, MedicationUpdateStatus>(MedicationUpdateStatus.InternalServerError)); } }
public bool DeleteMedication(Domain.Entities.Medications.Medication medication) => _medicationRepository.Delete(medication);
public bool DeleteMedication(Medication medication) => medicationRepository.Delete(medication);