protected virtual async Task UpdateUserAsync(CreateOrUpdateUserInput input) { Debug.Assert(input.User.Id != null, "input.User.Id should be set."); var user = input.User.MapTo<AuthorityUserInfo>(); user.LastModifierUserId = AbpSession.UserId; user.LastModifierUserName = GetCurrentUser().RealName; user.LastModificationTime = Clock.Now; await _userRepository.UpdateAsync(user); cacheHandler.Remove(CacheCategoryUser, "GetUserList"); }
protected virtual async Task CreateUserAsync(CreateOrUpdateUserInput input) { var user = input.User.MapTo<AuthorityUserInfo>(); user.Id = GuidHelper.NewGuid(); user.CreatorUserId = AbpSession.UserId; user.CreatorUserName = GetCurrentUser().RealName; user.CreationTime = Clock.Now; user.Password = new PasswordHasher().HashPassword("123456"); await _userRepository.InsertAsync(user); cacheHandler.Remove(CacheCategoryUser, "GetUserList"); }
/// <summary> /// 添加修改实体 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task CreateOrUpdateUser(CreateOrUpdateUserInput input) { if (input.User.Id != null && input.User.Id != Guid.Empty) { await UpdateUserAsync(input); } else { await CreateUserAsync(input); } }