public ActionResult Edit(Account user) { if (ModelState.IsValid) { var dao = new UserDao(); var pass = Encrytor.ToMD5(user.Password); user.Password = pass; var id = dao.Update(user); if (id) { SetAlert("Sửa mới thành công ", "success"); return(RedirectToAction("Index", "User")); } { ModelState.AddModelError("", "Cập nhập user không thành công "); } } return(View("Index")); }
public ActionResult Create(Account user) { if (ModelState.IsValid) { var dao = new UserDao(); var pass = Encrytor.ToMD5(user.Password); user.Password = pass; string id = dao.Insert(user); if (id != null) { SetAlert("Tạo mới thành công ", "success"); return(RedirectToAction("Index", "User")); } { ModelState.AddModelError("", "Thêm user không thành công "); } } return(View("Index")); }