Exemple #1
0
        public IActionResult AddTreatment(EditTreatmentViewModel model)
        {
            if (!ModelState.IsValid)
            {
            }

            var result = ContentExecute <TreatmentListItemViewModel>(() =>
            {
                var treatment = new Treatment
                {
                    MedicineId       = model.MedicineId,
                    Diagnosis        = model.Diagnosis,
                    SolutionVolume   = model.SolutionVolume,
                    Dosage           = model.Dosage,
                    InfusionSpeed    = model.InfusionSpeed,
                    DiseaseHistoryId = model.DiseaseHistoryId
                };
                var newTreatment = _treatmentService.AddTreatment(treatment);
                return(new TreatmentListItemViewModel(newTreatment));
            });

            return(Json(result));
        }