コード例 #1
0
        public async Task <IActionResult> PutBand(int id, Band band)
        {
            if (id != band.BandId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
ファイル: TracksController.cs プロジェクト: KOChz/LabelWebApi
        public async Task <IActionResult> PutTrack(int id, Track track)
        {
            if (id != track.TrackId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #3
0
        public async Task <IActionResult> PutAlbum(int id, Album album)
        {
            if (id != album.AlbumsId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }