public async Task <IEnumerable <EpisodeData> > GetAllEpisodesAsync(int filmProductionId, int season, string userId)
        {
            if (!await _filmProductionRepository.ExsistsAsync(filmProductionId))
            {
                throw new HttpStatusCodeException(HttpStatusCode.NotFound, "Nie znaleziono podanej produkcji filmowej");
            }

            if (!await _filmProductionRepository.IsSeriesAsync(filmProductionId))
            {
                throw new HttpStatusCodeException(HttpStatusCode.BadRequest, "Podana produkcja filmowa nie jest serialem.");
            }

            return(await _episodeRepository.GetAllEpisodes(filmProductionId, season, userId));
        }
 public IQueryable <EpisodeDTO> GetAllEpisodes()
 {
     return(_episodeRepository.GetAllEpisodes().Select(x => new EpisodeDTO(x.Id, x.Name)));
 }
Exemple #3
0
        public ActionResult <IEnumerable <EpisodeDto> > GetAllEpisodes()
        {
            var episodeFromRepo = _episodeRepository.GetAllEpisodes();

            return(Ok(_mapper.Map <IEnumerable <EpisodeDto> >(episodeFromRepo)));
        }