public ActionResult New() { var viewModel = new DepartmentsFormViewModel { Faculties = _context.Faculties.ToList() }; return(View("DepartmentForm", viewModel)); }
public ActionResult Edit(int id) { var faculties = _context.Faculties.ToList(); var departmentInDb = _context.Departments.Single(d => d.Id == id); var viewModel = new DepartmentsFormViewModel(departmentInDb); viewModel.Faculties = faculties; return(View("DepartmentForm", viewModel)); }