示例#1
0
        public async Task <ApiListResponse <UserShortDataModel> > AdminGetCollection(int skip, int limit, string q)
        {
            if (skip < 0)
            {
                skip = 0;
            }
            if (limit > MAX_LIMIT)
            {
                limit = MAX_LIMIT;
            }
            else if (limit < 0)
            {
                limit = 1;
            }

            var list = await _appUserRepository.Get(skip, limit, q);

            var result = new ApiListResponse <UserShortDataModel>
            {
                Skip  = skip,
                Limit = limit,
                Total = await _appUserRepository.Count(),
                Data  = list?.Select(x => _mapper.Map <UserShortDataModel>(x)).ToList() ?? new List <UserShortDataModel>()
            };

            return(result);
        }
示例#2
0
        public void Update(AppUser user)
        {
            var existingUser = _users.Get(user.Id);

            existingUser.Name = user.Name;
            existingUser.Age  = user.Age;
        }