Ejemplo 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));
        }
Ejemplo 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);
        }
Ejemplo 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));
 }
Ejemplo n.º 5
0
 IEnumerable <Movie> all_matching(MovieCriteria criteria)
 {
     return(movies.all_items_matching(criteria.Invoke));
 }
Ejemplo 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));
 }
Ejemplo n.º 7
0
 public IEnumerable <Movie> all_movies_matching(MovieCriteria criteria)
 {
     return(movies.all_items_matching(new AnonymousMatch <Movie>(criteria.Invoke)));
 }