public ActionResult CreateDepart(DepartMent input) { if (ModelState.IsValid) { var depart = new DepartMent(); depart.Name = input.Name; depart.Description = input.Description; _departRepository.Add(depart); UnitOfWork.Commit(); return RedirectToAction("DepartMentIndex", "appsetting"); } return View(input); }
// // GET: /AppSetting/Create public ActionResult CreateDepart() { var model = new DepartMent(); return View(model); }
public ActionResult EditDepart(int id, FormCollection collection) { var model = new DepartMent(); TryUpdateModel(model); if (ModelState.IsValid) { var depart = _departRepository.Find(id); depart.Name = model.Name; depart.Description = model.Description; depart.DateCreated = model.DateCreated; UnitOfWork.Commit(); // TempData.SetStatusMessage(""); return RedirectToAction("DepartMentIndex", "AppSetting"); } return View(model); }