Exemplo n.º 1
0
        public async Task <IActionResult> GetMovies(MovieCriteria filters, string orderBy = "Rating.desc", int pageNumber = 1)
        {
            var movies = await _movieService.ListMoviesAsync(filters, orderBy, PageSize, pageNumber);

            var model = _mapper.Map <MovieListPagedViewModel>(movies);

            return(PartialView("MovieCardList", model));
        }
Exemplo n.º 2
0
        public async Task <PagedResult <MovieDto> > ListMoviesAsync(MovieCriteria filters, string orderBy, int pageSize, int pageNumber)
        {
            var movies = await _db.Movies
                         .FilterByCriteria(filters)
                         .OrderByPropertyName(orderBy)
                         .ThenByDescending(m => m.VotesCount)
                         .ProjectTo <MovieDto>(AutoMapperConfiguration.Config)
                         .AsNoTracking()
                         .PaginateAsync(pageNumber, pageSize);

            return(movies);
        }
Exemplo n.º 3
0
 IEnumerable<Movie> all_matching(MovieCriteria criteria)
 {
     return movies.all_items_matching(criteria.Invoke);
 }
 public IEnumerable<Movie> all_movies_matching(MovieCriteria criteria)
 {
     return movies.all_items_matching(new AnonymousMatch<Movie>(criteria.Invoke));
 }
Exemplo n.º 5
0
 IEnumerable <Movie> all_matching(MovieCriteria criteria)
 {
     return(movies.all_items_matching(criteria.Invoke));
 }
Exemplo n.º 6
0
 public static IQueryable <Movie> FilterByCriteria(this IQueryable <Movie> source, MovieCriteria criteria)
 {
     return(source
            .FilterByRating(criteria.RatingFrom, criteria.RatingTo)
            .FilterByGenres(criteria.Genres)
            .FilterByReleaseDate(criteria.ReleaseDateFrom, criteria.ReleaseDateTo)
            .FilterByVotesCount(criteria.VotesCountFrom, criteria.VotesCountTo));
 }
Exemplo n.º 7
0
 public IEnumerable <Movie> all_movies_matching(MovieCriteria criteria)
 {
     return(movies.all_items_matching(new AnonymousMatch <Movie>(criteria.Invoke)));
 }