// GET: Journal/Create public ActionResult Create() { var doctors = _doctorRepository.GetAll().Select(x => new DoctorViewModel { DoctorId = x.DoctorId, FirstName = x.FirstName, SecondName = x.SecondName }); var medRecord = _medRecordRepository.GetAll().Select(x => new MedRecordViewModel { MedRecordId = x.MedRecordId, DOB = x.DOB, FirstName = x.FirstName, SecondName = x.SecondName }); var procedures = _procedureRepository.GetAll().Select(x => new ProcedureViewModel { ProcedureId = x.ProcedureId, Name = x.Name }); var addJournalViewModel = new AddJournalViewModel { Doctors = doctors, MedRecords = medRecord, Procedures = procedures }; return(View(addJournalViewModel)); }
public ActionResult Create(AddJournalViewModel model) { var journal = new Journal { ExecutingDate = model.ExecutingDate, DoctorId = model.DoctorId, ProcedureId = model.ProcedureId, MedRecordId = model.MedRecordId }; _journalRepository.Add(journal); return(RedirectToAction(nameof(Index))); }