Example #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());
        }
Example #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());
        }