コード例 #1
0
 public async Task <FilmTheatre[]> GetFilmTheatresAsync(TheatreRequest theatreRequest)
 {
     return(await _filmTheatreDataSet
            .Where(t => (theatreRequest.FilmId == null || t.FilmId == theatreRequest.FilmId) &&
                   (theatreRequest.EndDate == null || t.StartDistributionDate < theatreRequest.EndDate) &&
                   (theatreRequest.StartDate == null || theatreRequest.StartDate < t.EndDistributionDate))
            .Include(t => t.Theatre)
            .Include(t => t.Theatre.Country)
            .ToArrayAsync());
 }
コード例 #2
0
        public async Task <IEnumerable <FilmTheatreResponse> > GetTheatresAsync(TheatreRequest theatreRequest)
        {
            var records = await _filmTheatreRepository.GetFilmTheatresAsync(theatreRequest);

            if (theatreRequest.FilmId == null)
            {
                return(null);
            }

            var totalBoxOffice = records.Sum(p => p.BoxOfficePerMovie);

            return(records
                   .Select(p => new FilmTheatreResponse
            {
                Title = p.Theatre.Title,
                Country = p.Theatre.Country.Name,
                PercentageOfBoxOffice = (double?)(p.BoxOfficePerMovie / totalBoxOffice) * 100
            }));
        }
コード例 #3
0
 public async Task <IEnumerable <FilmTheatreResponse> > GetFilmTheatres([FromBody] TheatreRequest theatreRequest)
 {
     return(await _screeningManagementService.GetTheatresAsync(theatreRequest));
 }