Ejemplo n.º 1
0
 private EMUser ConvertTo(UpdateUserViewModel entity)
 {
     EMUser model = null;
     if (entity != null)
     {
         IUserService userService = new UserService();
         EMUser eMUser = userService.GetUser(entity.UserCode);
         model = new EMUser();
         model.UserCode = entity.UserCode;
         model.UserName = entity.UserName;
         model.IsRegisterUser = entity.IsRegisterUser;
         model.PassWord = entity.PassWord;
         model.RealName = entity.RealName;
         model.Mobile = entity.Mobile;
         model.Tenant = new EMTenant() { TenantCode = entity.TenantCode };
         model.LastLoginTime = entity.LastLoginTime;
         model.CreateTime = eMUser.CreateTime;
         model.UserGroupID = entity.UserGroupID;
     }
     return model;
 }
Ejemplo n.º 2
0
        public ResultContent UpdateUser(UpdateUserViewModel userViewModel)
        {
            ResultContent rc = new ResultContent();
            try
            {
                IUserService userService = new UserService();

                EMUser newEntity = ConvertTo(userViewModel);
                userService.Update(newEntity);
                rc.Result = true;
                rc.Message = "修改成功!";
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message, ex);
                rc.Result = false;
                rc.Message = ex.Message;
            }
            return rc;
        }