コード例 #1
0
        public async Task <ActionResult <Episodes> > PutEpisodes(long id, Episodes episodes)
        {
            if (id != episodes.Id)
            {
                return(BadRequest());
            }

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

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

            return(episodes);
        }
コード例 #2
0
        public async Task <ActionResult <Podcast> > PutPodcast(long id, Podcast podcast)
        {
            if (id != podcast.Id)
            {
                return(BadRequest());
            }

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

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

            return(podcast);
        }
コード例 #3
0
        public async Task <ActionResult <Favorites> > PutFavorites(long id, Favorites favorite)
        {
            if (id != favorite.Id)
            {
                return(BadRequest());
            }

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

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

            return(favorite);
        }
コード例 #4
0
        public async Task <IActionResult> PutUser(long id, User user)
        {
            if (id != user.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }