Ejemplo n.º 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());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutMusic(int id, Music music)
        {
            if (id != music.Id)
            {
                return(BadRequest("L'ID doit être fourni"));
            }
            if (!String.IsNullOrEmpty(music.Validation))
            {
                return(BadRequest("Que cherchez vous ?"));
            }

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

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

            return(NoContent());
        }