Пример #1
0
        public async Task <GetManyAuthorsQueryResult> Handle(GetManyAuthorsQuery request, CancellationToken cancellationToken)
        {
            // load from database
            IQueryable <AuthorEntity> authorEntities = await _authorsRepository.GetAllAsync(request.Skip, request.Take);

            int totalCount = await _authorsRepository.CountAsync();

            // map
            IList <Author> authors = authorEntities.AsEnumerable().Select(AuthorMapper.MapToModel).ToList();

            // return
            return(new GetManyAuthorsQueryResult(authors, totalCount));
        }