예제 #1
0
        public async Task ModifyAsync([Required] ModifyUserInput input)
        {
            var user = input.Adapt <User>();

            // 配置主键和更新时间
            user.Id          = _userManager.UserId;
            user.UpdatedTime = DateTimeOffset.Now;

            await _userRepository.UpdateExcludeAsync(user, new[] { nameof(User.IsDeleted), nameof(user.CreatedTime) }, ignoreNullValues : true);
        }
예제 #2
0
        public async Task ModifyAsync([Required, Range(1, int.MaxValue, ErrorMessage = "请输入有效的用户 Id"), ApiSeat(ApiSeats.ActionStart)] int userId, [Required] ModifyUserInput input)
        {
            // 查询用户是否存在
            _ = await _userManager.CheckUserAsync(userId, false);

            var user = input.Adapt <User>();

            // 配置主键和更新时间
            user.Id          = userId;
            user.UpdatedTime = DateTimeOffset.Now;

            await _userRepository.UpdateExcludeAsync(user, new[] { nameof(User.IsDeleted), nameof(User.CreatedTime) }, ignoreNullValues : true);
        }