Пример #1
0
        public IActionResult PatientData(Guid id, Guid patientId, Guid schedId)
        {
            var patientData = patientDataService.GetById(id);

            if (patientData.ScheduleId == Guid.Empty)
            {
                patientData.ScheduleId = schedId;
            }
            if (patientData.PatientId == Guid.Empty)
            {
                patientData.PatientId = patientId;
            }
            var props     = patientDataService.GetProps();
            var viewModel = new DoctorDateViewModel()
            {
                Patient = patientData.PatientId != Guid.Empty ?
                          patientService.GetPatient(patientData.PatientId)
                    : patientService.GetPatient(patientId),
                DoctorDatas = patientData,
                Properties  = props.Select(x => new SelectListItem()
                {
                    Text     = x.Name,
                    Value    = x.Id.ToString(),
                    Selected = x.Name == patientData.PropName
                }).ToList()
            };

            return(View(viewModel));
        }
Пример #2
0
 public IActionResult PatientData(DoctorDateViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         if (viewModel.DoctorDatas.Id == Guid.Empty)
         {
             patientDataService.Create(viewModel.DoctorDatas);
         }
         else
         {
             patientDataService.Update(viewModel.DoctorDatas);
         }
         return(RedirectToAction("AppointmentResult", new { schedId = viewModel.DoctorDatas.ScheduleId }));
     }
     return(View(viewModel));
 }