Exemple #1
0
        public async Task <CollectionResult <AccountPublicDto> > SearchUsers(AccountSearchDto model)
        {
            var result = new CollectionResult <AccountPublicDto>();

            var entities = _userManager
                           .Users
                           .WhereIf(model.Status != null, item => item.Status == model.Status)
                           .Include(x => x.ReservedBooks)
                           .AsQueryable();

            var searchResult = await entities.ToListAsync();

            if (searchResult != null)
            {
                result.Items        = _mapper.Map <List <ApplicationUser>, List <AccountPublicDto> >(searchResult);
                result.IsSuccessful = true;
            }

            return(result);
        }
        public async Task <IActionResult> SearchUsers([FromBody] AccountSearchDto model)
        {
            var result = await _accountService.SearchUsers(model);

            return(new OkObjectResult(result));
        }