Ejemplo n.º 1
0
        public async Task <IActionResult> CreatOrEdit(UserCreatOrEditInputModel model)
        {
            UserDto dto = new UserDto()
            {
                Address                = "",
                CreatorUserId          = 0,
                IsDelete               = false,
                CreationTime           = DateTime.Now,
                Email                  = "",
                Id                     = 0,
                UserName               = "",
                PhoneNum               = "",
                PasswordSalt           = "",
                Password               = "",
                LoginErrorTimes        = 0,
                LastLoginErrorDateTime = null
            };

            if (model.id > 0)
            {
                //修改

                await _userService.UpdateAsync(dto);
            }
            else
            {
                await _userService.AddAsync(dto);
            }
            return(View());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> CreatOrEdit(UserCreatOrEditInputModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }
            if (model.Password != model.TruePassword)
            {
                return(View());
            }
            UserDto dto = new UserDto()
            {
                Address                = model.Address,
                CreatorUserId          = 0,
                IsDelete               = false,
                CreationTime           = DateTime.Now,
                Email                  = model.Email,
                Id                     = model.Id,
                UserName               = model.Email,
                PhoneNum               = model.PhoneNum,
                PasswordSalt           = "",
                Password               = model.Password,
                LoginErrorTimes        = 0,
                LastLoginErrorDateTime = null
            };

            if (model.Id > 0)
            {
                //修改

                await _userService.UpdateAsync(dto);
            }
            else
            {
                await _userService.AddAsync(dto);
            }
            return(View());
        }