public async Task <IActionResult> PutPodcastEpisode([FromQuery] int id, [FromBody] PodcastEpisode podcastEpisode)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != podcastEpisode.Id)
            {
                return(BadRequest());
            }

            _context.Entry(podcastEpisode).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PodcastEpisodeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> PutFollowedPodcast([FromQuery] string rss, [FromBody] FollowedPodcast followedPodcast)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (rss != followedPodcast.Rss)
            {
                return(BadRequest());
            }

            _context.Entry(followedPodcast).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FollowedPodcastExists(rss))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }