public async Task <ActionResult <PodcastDto> > DeletePodcast(int id)
        {
            if (!PodcastLogic.PodcastExists(id))
            {
                return(NotFound());
            }
            var podcast = await PodcastLogic.DeletePodcastAsync(id);

            return(Ok(podcast));
        }
        public async Task <ActionResult <MovieDto> > AddTimestampToEpisode(int id, [FromBody] TimestampForCreationDto timestamp)
        {
            if (!PodcastLogic.PodcastExists(id))
            {
                return(NotFound());
            }

            timestamp.PodcastId = id;
            var returnPodcast = await PodcastLogic.AddTimestampToPodcastAsync(timestamp);

            return(CreatedAtAction("GetPodcast", new { id = returnPodcast.Id }, returnPodcast));
        }
        public async Task <ActionResult <PodcastDto> > UpdatePodcast(int id, [FromBody] PodcastDto podcast)
        {
            if (id != podcast.Id)
            {
                return(BadRequest());
            }
            if (!PodcastLogic.PodcastExists(id))
            {
                return(NotFound());
            }
            PodcastDto returnPodcast = await PodcastLogic.UpdatePodcastAsync(podcast);

            return(Ok(returnPodcast));
        }
Exemplo n.º 4
0
        public async Task <ActionResult <MovieDto> > AddMovieToEpisode(int id, int episodeId, [FromBody] MovieEpisodeDto movieEpisode)
        {
            movieEpisode.MovieId   = id;
            movieEpisode.EpisodeId = episodeId;
            if (!MovieLogic.MovieExists(id))
            {
                return(NotFound());
            }
            if (!PodcastLogic.PodcastExists(episodeId))
            {
                return(NotFound());
            }
            var returnMovie = await MovieLogic.AddMovieToEpisodeAsync(movieEpisode);

            return(CreatedAtAction("GetMovie", new { id = returnMovie.Id }, returnMovie));
        }