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()); }
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()); }