// GET: Department public ActionResult Index() { IEnumerable <Department> departments = m_repo.GetAllDepartments(); if (!departments.Any()) { //If there are no buildings, we should provide the ability to create them? return(RedirectToAction("Create")); } //paginate buildings, what if there are 10000, do we want the user to scroll through all of that? //look up IPagedList<T> return(View(departments.ToList())); }
// GET: Employee/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Employee employee = m_repo.GetEmployee(id.Value); if (employee == null) { return(HttpNotFound()); } ViewBag.DepartmentId = new SelectList(m_repo.GetAllDepartments(), "Id", "Name", employee.DepartmentId); return(View(employee)); }
// GET: EmployeesTest/Create public ActionResult Create() { // var m_repo = new EmployeesTestController(new PeopleProRepo()); ViewBag.DepartmentId = new SelectList(m_repo.GetAllDepartments(), "Id", "Name"); return(View()); }