public IActionResult Add(PatientMedicalReportViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            using (var transaction = _patientMedicalReportsRepository.BeginTransaction())
            {
                try
                {
                    PatientMedicalReport patientMedicalReport = model;
                    patientMedicalReport.DateTimeCreated = DateTime.Now;
                    _patientMedicalReportsRepository.Add(patientMedicalReport);

                    PatientReception patientReception = _patientReceptionsRepository.GetById(patientMedicalReport.PatientReceptionsId);
                    patientReception.IsThereMedicalReport = true;
                    _patientReceptionsRepository.Update(patientReception);

                    _patientMedicalReportsRepository.SaveChanges();
                    _patientReceptionsRepository.SaveChanges();

                    transaction.Commit();

                    return(RedirectToAction("Index", "PatientReceptions"));
                }
                catch (Exception)
                {
                    transaction.Rollback();
                    return(RedirectToAction("Index", "PatientReceptions"));
                }
            }
        }
        public IActionResult Add(int id) //patientReceptionId
        {
            PatientMedicalReportViewModel model = new PatientMedicalReportViewModel();

            model.PatientReceptionsId = id;
            return(View(model));
        }
        public IActionResult Edit(PatientMedicalReportViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            try
            {
                PatientMedicalReport patientMedicalReport = model;
                patientMedicalReport.DateTimeCreated = DateTime.Now;
                _patientMedicalReportsRepository.Update(patientMedicalReport);

                _patientMedicalReportsRepository.SaveChanges();

                return(RedirectToAction(nameof(Index), new { id = patientMedicalReport.PatientReceptionsId }));
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
        public IActionResult Edit(int id)
        {
            PatientMedicalReportViewModel model = _patientMedicalReportsRepository.GetById(id);

            return(View(model));
        }
        public IActionResult IndexPartial(int id)
        {
            PatientMedicalReportViewModel model = _patientMedicalReportsRepository.GetByPatientReceptionId(id);

            return(PartialView("_Index", model));
        }
        public IActionResult Index(int id) //patientReceptionId
        {
            PatientMedicalReportViewModel model = _patientMedicalReportsRepository.GetByPatientReceptionId(id);

            return(View(model));
        }