public ActionResult Create(UserModel model) { try { if (ModelState.IsValid) { unitOfWork.UserRepository.Insert(model); unitOfWork.Save(); return RedirectToAction("Index"); } return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Edit(int id, UserModel model) { try { if (ModelState.IsValid) { var _data = unitOfWork.UserRepository.GetByID(model.ID); _data.IsActive = model.IsActive; _data.UserName = model.UserName; _data.Password = model.Password; _data.LastUpdate = DateTime.Now; unitOfWork.UserRepository.Update(_data); unitOfWork.Save(); return RedirectToAction("Index"); } return RedirectToAction("Index"); } catch { return View(); } }