public ActionResult Edit(int id, DepartmentModel model) { try { if (id == 0) return RedirectToAction("Index"); var department = Mapper.Map<DepartmentModel, Department>(model); _departmentService.Update(department); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Delete(int id, DepartmentModel model) { try { if (id == 0) return RedirectToAction("Index"); var category = _departmentService.GetById(id); _departmentService.Delete(category); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Create(DepartmentModel model) //FormCollection collection { try { // TODO: Add insert logic here if (model == null) return View(); var department = Mapper.Map<DepartmentModel, Department>(model); _departmentService.Insert(department); return RedirectToAction("Index"); } catch { return View(model); } }
// // GET: /Category/Create public ActionResult Create() { var model = new DepartmentModel(); return View(model); }