Пример #1
0
        public async Task <Dto.Common.Page <Movie> > GetMoviesAsync(MoviesQueryFilter queryFilter)
        {
            var orderByFilters = _orderByFilterParser.Parse <Movie>(queryFilter?.Orderby) ?? new[] { nameof(Movie.Date) };

            var pagingFilter = new MoviesPagingFilter
            {
                OrderBy     = orderByFilters,
                Page        = queryFilter?.Page,
                Size        = queryFilter?.Size,
                SearchQuery = queryFilter?.Search,
                Studios     = queryFilter?.Studios,
                Categories  = queryFilter?.Categories,
                Models      = queryFilter?.Models,
                Date        = queryFilter?.Date
            };

            var page = await _movies.FindMoviesAsync(pagingFilter);

            var result = new Dto.Common.Page <Movie>
            {
                Data   = _mapper.Map <IEnumerable <Movie> >(page.Data),
                Size   = page.Size,
                Offset = page.Offset,
                Total  = page.Total
            };

            return(result);
        }
Пример #2
0
 public async Task <IActionResult> GetAllMoviesAsync([FromQuery] MoviesQueryFilter filter, CancellationToken cancellationToken)
 => await _processor.ProcessAsync(new MoviesQuery { Filter = filter }, cancellationToken);
Пример #3
0
        public async Task <IActionResult> GetMoviesAsync([FromQuery] MoviesQueryFilter queryFilter)
        {
            var page = await _movieService.GetMoviesAsync(queryFilter);

            return(Ok(page));
        }