Esempio n. 1
0
        public ActionResult ChangePwd(string Id)
        {
            var model  = new AdminChangePwdModel();
            var entity = UserService.Users.Where(t => t._ID == Id).FirstOrDefault();

            if (entity != null)
            {
                model.Id        = entity._ID;
                model.LoginName = entity.LoginName;
                model.Email     = entity.Email;
            }
            return(PartialView(model));
        }
Esempio n. 2
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public OperationResult Update(AdminChangePwdModel model)
        {
            var entity = HpMongoContext.User.Where(t => t._ID == model.Id && t.IsDeleted != true).FirstOrDefault();

            if (entity == null)
            {
                return(new OperationResult(OperationResultType.Error, "用户不存在"));
            }
            entity.LoginPwd   = DESProvider.EncryptString(model.NewLoginPwd);
            entity.ModifyId   = model.ModifyId;
            entity.ModifyBy   = model.ModifyBy;
            entity.ModifyTime = DateTime.Now;
            this.UpdateBaseData <Admin>(entity, model);
            HpMongoContext.Save(entity);
            return(new OperationResult(OperationResultType.Success, "修改密码成功"));
        }
Esempio n. 3
0
 public ActionResult ChangePwd(AdminChangePwdModel model)
 {
     if (ModelState.IsValid)
     {
         this.UpdateBaseData <AdminChangePwdModel>(model);
         OperationResult result = UserService.Update(model);
         if (result.ResultType == OperationResultType.Success)
         {
             return(Json(result));
         }
         else
         {
             return(PartialView(model));
         }
     }
     else
     {
         return(PartialView(model));
     }
 }