public ActionResult SuaUser(NhanVienViewModel user) { //if (!Models.User.CurrentUser.Quyen.CoChucNang("sua_user")) //{ // return RedirectToAction("Error", "Admin"); //} if (ModelState.IsValid) { var user_u = db.Users.SingleOrDefault(u => u.Id == user.Id); if (user_u.MatKhau != user.MatKhau) { user.MatKhau = Utilities.EditString.mahoa_md5(user.MatKhau); } BabyToys.DAL.RegisterDAL reg = new DAL.RegisterDAL(); reg.SuaNhanVien(user); return RedirectToAction("Index"); } ViewBag.IdQuyen = new SelectList(db.Quyens.ToList(), "IdQuyen", "TenQuyen", user.IdQuyen); return View(user); }
public ActionResult DoiMatKhauUser(NhanVienViewModel user) { if (ModelState.IsValid) { var user_u = db.Users.SingleOrDefault(u => u.Id == user.Id); if (user_u.MatKhau != user.MatKhau) { user.MatKhau = Utilities.EditString.mahoa_md5(user.MatKhau); } BabyToys.DAL.RegisterDAL reg = new DAL.RegisterDAL(); reg.SuaNhanVien(user); return RedirectToAction("Index"); } ViewBag.IdQuyen = new SelectList(db.Quyens.ToList(), "IdQuyen", "TenQuyen", user.IdQuyen); return View(user); }