Esempio n. 1
0
        public async Task <bool> Delete(int id)
        {
            _treatmentRepository.Delete(id);
            var recordUpdated = await _treatmentRepository.SaveChangeAsync();

            return(recordUpdated > 0);
        }
        public async Task <IActionResult> Delete(Guid id)
        {
            if (ManagedYearPlan == null)
            {
                return(ActionIfNotChoosedManagedYearPlan());
            }

            var @operator = await _treatmentRepository.GetById(id);

            await _treatmentRepository.Delete(@operator);

            return(RedirectToAction("Index"));
        }
        public ActionResult Delete(TreatmentViewModel treatmentViewModel, int medicalRecordId)
        {
            treatmentViewModel.MedicalRecordEntryViewModel = medicalRecordEntryRepository.GetById(medicalRecordId).ToViewModel();
            AddMedicalRecordToTempData(treatmentViewModel.MedicalRecordEntryViewModel.Id);

            if (ModelState.IsValid)
            {
                AddMedicalRecordToTempData(treatmentViewModel.MedicalRecordEntryViewModel.Id);
                treatmentRepository.Delete(treatmentViewModel.ToDomainModel());
                return(RedirectToAction("Index", new { medicalRecordId = treatmentViewModel.MedicalRecordEntryViewModel.Id }));
            }
            AddMedicalRecordToTempData(treatmentViewModel.MedicalRecordEntryViewModel.Id);
            return(View(treatmentViewModel));
        }