示例#1
0
        public ActionResult ChangePassword(AccountChangePassModel model)
        {
            //#region Permission
            //bool bPermission = _permissionService.PERMISSION(AccountIsAuthenticated(), ConfigPermission.ManagerAccount);
            //if (bPermission.Equals(false))
            //{
            //    return RedirectToAction("Index", "Mainternance", new { area = "Admin" });
            //}
            //#endregion
            model.ModifiedBy = AccountIsAuthenticated();
            model.UserName   = AccountIsAuthenticated();

            MessageModel msg = _accountService.ChangePassword(model);

            ViewBag.message = Globals.ErrorMessage(msg.message, msg.result);
            return(View());
        }
示例#2
0
        private MessageModel ValidateChangePass(AccountChangePassModel model)
        {
            var msgModel = new MessageModel();

            if (model == null)
            {
                msgModel.result  = false;
                msgModel.message = "Account Incorrect !";
            }
            else if (model.PassNew != model.PassNew)
            {
                msgModel.result  = false;
                msgModel.message = "Password Invalid, please check again !";
            }
            else
            {
                msgModel.result  = true;
                msgModel.message = ConstantsHandler.ErrorMessage.Message_OK;
            }
            return(msgModel);
        }
示例#3
0
        public MessageModel ChangePassword(AccountChangePassModel model)
        {
            var msgModel = new MessageModel();

            try
            {
                msgModel = ValidateChangePass(model);
                if (msgModel.result.Equals(false))
                {
                    return(msgModel);
                }
                var mapper       = Mapper.Map <AccountChangePassModel, AccountChangePassEntity>(model);
                var mapperEntity = _accountRepository.ChangePassword(mapper);
                msgModel = Mapper.Map <MessageEntity, MessageModel>(mapperEntity);
            }
            catch (Exception ex)
            {
                msgModel.result  = false;
                msgModel.message = ConstantsHandler.ErrorMessage.Message_EX;
                Logger.ErrorLog(ConstantsHandler.ForderLogName.ServiceAccount, "ChangePassword : ", ex.ToString());
            }
            return(msgModel);
        }