// // GET: /Employee/Create public ActionResult Create() { Employee model =new Employee(); model.ActionOperationType = EActionOperationType.Create; this.LoadCreateViewBag(); return View("Create",model); }
public ActionResult Edit(Employee model) { model.ActionOperationType = EActionOperationType.Edit; if (ModelState.IsValid) { EmployeeService service = new EmployeeService(); service.Update(model); return RedirectToAction("Index"); } this.LoadEditViewBag(model); return View("Create",model); }
private void LoadEditViewBag(Employee model) { DepartmentService departmentService = new DepartmentService(); ViewBag.DepartmentId = new SelectList(departmentService.Query(p => p.IsActive=="1"), "Id", "Name",model.DepartmentId); }