public async Task <ActionResult> CreateDept(AppDeptViewModel vm, IFormCollection collection) { var tes = new TestDepartment { DeptId = vm.DepartmentId, Department = vm.Department //Patients = new PatientForm //{ // Fullname = vm.Fullname, // Age = vm.Age, // ClinicalDiagnosis = vm.ClinicalDiagnosis, // DateOfRequest = vm.DateOfRequest, // Physician = new Physician // { // PhysicianName = vm.Physician // } //}, //Tests = /*(from product in _ctx.Tests new PatientTest)*/{ //}, // Result = new TestResult // { // IsCompleted = vm.IsCompleted // }, }; try { _testRepo.AddDepartment(tes); await _testRepo.SaveChangesAsync(); return(RedirectToAction("Department", "Home")); } catch { return(View(tes)); } }