コード例 #1
0
        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());
            }
        }
コード例 #2
0
        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));
        }