Exemple #1
0
        public async Task <IActionResult> PutMusic(int id, Music music)
        {
            if (id != music.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutComposer(int id, Composer composer)
        {
            if (id != composer.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }