public void CreateSickLeaveList(SickLeaveListInputModel input) { var patient = _db.Users.Where(p => p.Id == input.PatientId).FirstOrDefault(); var doctor = _db.Users.Where(d => d.Id == input.DoctorId).FirstOrDefault(); var mkbdiagnose = _db.MKBDiagnoses.Where(m => m.Id == input.MKBDiagnoseId).FirstOrDefault(); var sickLeave = new SickLeaveList { Doctor = doctor, Patient = patient, LAKNumber = input.LAKNumber, Continuation = input.Continuation, DateOfIssue = input.DateOfIssue, Diagnosis = input.Diagnosis, DisabilityReason = input.DisabilityReason, StartDate = input.StartDate, EndDate = input.EndDate, MKBDiagnose = mkbdiagnose, OutpatientJournalNumber = input.OutpatientJournalNumber, RegistryNumber = input.RegistryNumber, TreatmentRegimen = input.TreatmentRegimen, }; this._db.SickLeaveLists.Add(sickLeave); var result = this._db.SaveChanges(); }
public SickLeaveListInputModel PrepareSickLeaveInputModel() { var listAllPatients = this.GetAllPatients(); var MKBList = _db.MKBDiagnoses.ToList(); var doctorUserName = _signInManager.Context.User.Identity.Name; var doctor = this._db.Users.Where(x => x.UserName == doctorUserName).FirstOrDefault(); var sickLeaveInputModel = new SickLeaveListInputModel { DoctorFullName = doctor.FullName, DoctorId = doctor.Id, PatientsList = listAllPatients, MKBDiagnoseList = MKBList, DateOfIssue = DateTime.Now }; return(sickLeaveInputModel); }
public IActionResult CreateSickLeaveList(SickLeaveListInputModel input) { _doctorService.CreateSickLeaveList(input); return(this.Redirect("/")); }