public ActionResult DoiMatKhau(DoiMatKhauModel model) { ViewBag.userSession = Session[CommonConstant.USER_SESSION]; var dmkDAO = new UserDao().DoiMatKhau(ViewBag.userSession.ID, MaHoaMD5.MD5Hash(model.MatKhauCu), MaHoaMD5.MD5Hash(model.MatKhau)); if (dmkDAO == true) { return(View("dmkOKE")); } else { return(View()); } }
public HttpResponseMessage DoiMatKhau(HttpRequestMessage request, DoiMatKhauModel model) { TaiKhoan doiMatKhauTaiKhoan = null; try { doiMatKhauTaiKhoan = _taiKhoanService.DoiMatKhau(model.PassNew, model.PassOld, model.UserName); if (doiMatKhauTaiKhoan != null) { _taiKhoanService.SaveChange(); Message = "Đổi mật khẩu thành công"; } else { throw new DbEntityValidationException("Username and pass fail"); } } catch (DbEntityValidationException ex) { LogException(ex); } return(GetResponseMessage(IsSuccess, Message, 1, doiMatKhauTaiKhoan)); }