Beispiel #1
0
 private IEnumerable <MovieInfo> GetMovieInfo(List <Movie> movies, List <Genre> genres, List <MovieGenre> genresByMovie)
 {
     return(movies.SelectMany(m =>
                              m.Session.Select(s => new { movie = m, seats = s.SeatsSold, size = s.Room?.Size }))
            .GroupBy(m => new { m.movie, m.size }, m => m.seats ?? 0,
                     (size, seats) => new { movieWithSeats = size, seatsSold = seats.Sum() })
            .OrderByDescending(m => m.seatsSold)
            .ThenByDescending(m => m.movieWithSeats.movie.ReleaseDate)
            .Select(movieItem => MovieInfo.Create(movieItem.movieWithSeats.movie.OriginalTitle,
                                                  string.Empty,
                                                  GetMoviesGenre(genresByMovie, genres, movieItem.movieWithSeats.movie.Id),
                                                  movieItem.movieWithSeats.movie.OriginalLanguage,
                                                  movieItem.movieWithSeats.movie.ReleaseDate,
                                                  movieItem.seatsSold,
                                                  ScreenSize.Create(movieItem.movieWithSeats.size))));
 }
Beispiel #2
0
        private async Task <List <MovieInfo> > GetMoviesForScreenSize(string request, int page, ScreenSize screenSize)
        {
            var apiResult = await request.AddQueryParam("page", page).GetJsonFromUrlAsync();

            var tmdbResponse = DeserializeResponse(apiResult);

            return(tmdbResponse?.Results?
                   .Select(movie => MovieInfo.Create(movie.Title,
                                                     movie.Overview,
                                                     GetMovieGenres(movie.GenreIds),
                                                     movie.OriginalLanguage,
                                                     movie.ReleaseDate,
                                                     movie.VoteCount,
                                                     screenSize))
                   .OrderByDescending(m => m.Ranking)
                   .ThenByDescending(m => m.ReleaseDate)
                   .ToList());
        }
 private List <MovieInfo> ProxyMoviesSeed()
 {
     return(new List <MovieInfo>
     {
         MovieInfo.Create("Title1",
                          "Overview 1",
                          new List <string>()
         {
             "Action", "Adventure"
         },
                          "es",
                          new DateTime(2020, 4, 20),
                          800,
                          MovieInfo.SmallScreen),
         MovieInfo.Create("Title2",
                          "Overview 2",
                          new List <string>()
         {
             "Action", "Adventure"
         },
                          "es",
                          new DateTime(2020, 4, 20),
                          700,
                          MovieInfo.SmallScreen),
         MovieInfo.Create("Title3",
                          "Overview 3",
                          new List <string>()
         {
             "Action", "Adventure"
         },
                          "es",
                          new DateTime(2020, 4, 20),
                          600,
                          MovieInfo.BigScreen),
         MovieInfo.Create("Title4",
                          "Overview 4",
                          new List <string>()
         {
             "Action", "Adventure"
         },
                          "es",
                          new DateTime(2020, 4, 20),
                          500,
                          MovieInfo.BigScreen),
         MovieInfo.Create("Title5",
                          "Overview 5",
                          new List <string>()
         {
             "Action", "Adventure"
         },
                          "es",
                          new DateTime(2020, 4, 27),
                          400,
                          MovieInfo.SmallScreen),
         MovieInfo.Create("Title6",
                          "Overview 6",
                          new List <string>()
         {
             "Action", "Adventure"
         },
                          "es",
                          new DateTime(2020, 4, 27),
                          300,
                          MovieInfo.SmallScreen),
         MovieInfo.Create("Title7",
                          "Overview 7",
                          new List <string>()
         {
             "Action", "Adventure"
         },
                          "es",
                          new DateTime(2020, 4, 27),
                          200,
                          MovieInfo.BigScreen),
         MovieInfo.Create("Title8",
                          "Overview 8",
                          new List <string>()
         {
             "Action", "Adventure"
         },
                          "es",
                          new DateTime(2020, 4, 27),
                          100,
                          MovieInfo.BigScreen)
     });
 }
Beispiel #4
0
 private GetIntelligentBillboardResponse IntelligentBillboardResultSeed()
 {
     return(new GetIntelligentBillboardResponse(
                new List <Billboard>
     {
         Billboard.Create(new DateTime(2020, 4, 20),
                          new List <MovieInfo>()
         {
             MovieInfo.Create("Title1",
                              "Overview 1",
                              new List <string>()
             {
                 "Action", "Adventure"
             },
                              "es",
                              new DateTime(2020, 4, 20),
                              800,
                              MovieInfo.SmallScreen),
             MovieInfo.Create("Title2",
                              "Overview 2",
                              new List <string>()
             {
                 "Action", "Adventure"
             },
                              "es",
                              new DateTime(2020, 4, 20),
                              700,
                              MovieInfo.SmallScreen)
         },
                          new List <MovieInfo>()
         {
             MovieInfo.Create("Title3",
                              "Overview 3",
                              new List <string>()
             {
                 "Action", "Adventure"
             },
                              "es",
                              new DateTime(2020, 4, 20),
                              600,
                              MovieInfo.BigScreen),
             MovieInfo.Create("Title4",
                              "Overview 4",
                              new List <string>()
             {
                 "Action", "Adventure"
             },
                              "es",
                              new DateTime(2020, 4, 20),
                              500,
                              MovieInfo.BigScreen)
         }),
         Billboard.Create(new DateTime(2020, 4, 27),
                          new List <MovieInfo>()
         {
             MovieInfo.Create("Title5",
                              "Overview 5",
                              new List <string>()
             {
                 "Action", "Adventure"
             },
                              "es",
                              new DateTime(2020, 4, 27),
                              400,
                              MovieInfo.SmallScreen),
             MovieInfo.Create("Title6",
                              "Overview 6",
                              new List <string>()
             {
                 "Action", "Adventure"
             },
                              "es",
                              new DateTime(2020, 4, 27),
                              300,
                              MovieInfo.SmallScreen)
         },
                          new List <MovieInfo>()
         {
             MovieInfo.Create("Title7",
                              "Overview 7",
                              new List <string>()
             {
                 "Action", "Adventure"
             },
                              "es",
                              new DateTime(2020, 4, 27),
                              200,
                              MovieInfo.BigScreen),
             MovieInfo.Create("Title8",
                              "Overview 8",
                              new List <string>()
             {
                 "Action", "Adventure"
             },
                              "es",
                              new DateTime(2020, 4, 27),
                              100,
                              MovieInfo.BigScreen)
         })
     }.SomeNotNull()));
 }