public ActionResult EditDoc(DoctorTestViewModel vm, int id, IFormCollection collection) { var pat = new Physician { Id = vm.PhysicianId, PhysicianName = vm.PhysicianName, }; try { if (id > 0) { _repository.UpdatePhysician(pat); } else { _repository.UpdatePhysician(pat); } _testRepository.SaveChangesAsync(); return(RedirectToAction("Doctor", "Home")); } catch { return(View(pat)); } }
public ActionResult EditTest(DoctorTestViewModel vm, int id, IFormCollection collection) { var pat = new PatientTest { TestId = vm.TestId, TestName = vm.TestName, DepartmentId = vm.DepartmentId, }; try { if (id > 0) { _testRepository.UpdateTest(pat); } else { _testRepository.AddTest(pat); } _testRepository.SaveChangesAsync(); return(RedirectToAction("Index")); } catch { return(View(pat)); } }
public async Task <ActionResult> CreateDoc(DoctorTestViewModel vm, IFormCollection collection) { var phy = new Physician { Id = vm.TestId, PhysicianName = vm.PhysicianName, }; try { _repository.AddPhysician(phy); await _testRepository.SaveChangesAsync(); return(RedirectToAction("Doctor", "Home")); } catch { return(View(phy)); } }
// GET: TestController/Create public ActionResult CreateTest() { var deptList = (from dept in _ctx.Departments select new SelectListItem() { Text = dept.Department, Value = dept.DeptId.ToString(), }).ToList(); deptList.Insert(0, new SelectListItem() { Text = "---Select---", Value = string.Empty }); DoctorTestViewModel vm = new DoctorTestViewModel(); vm.deptL = deptList; return(View(vm)); }
// GET: TestController/Edit/5 public ActionResult EditDoc(int id) { if (id == 0) { return(View(new DoctorTestViewModel())); } else { var phy = _repository.GetPhysician(id); var res = new DoctorTestViewModel { PhysicianId = phy.Id, PhysicianName = phy.PhysicianName // = test.TestName, //DepartmentName = dept.Department }; return(View(res)); } }
// GET: TestController/Edit/5 public ActionResult EditTest(int id) { if (id == 0) { return(View(new DoctorTestViewModel())); } else { var test = _testRepository.GetTest(id); var dept = _testRepository.GetDepartment(id); var res = new DoctorTestViewModel { TestId = test.TestId, TestName = test.TestName, DepartmentId = test.DepartmentId }; return(View(res)); } }
public async Task <ActionResult> CreateTest(DoctorTestViewModel vm, IFormCollection collection) { var pat = new PatientTest { TestId = vm.TestId, TestName = vm.TestName, DepartmentId = vm.DepartmentId, //Department = vm.deptL }; try { _testRepository.AddTest(pat); await _testRepository.SaveChangesAsync(); return(RedirectToAction("Index")); } catch { return(View(pat)); } }