public async Task <IActionResult> PutKindMusic([FromRoute] long id, [FromBody] KindMusic kindMusic) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != kindMusic.KId) { return(BadRequest()); } _context.Entry(kindMusic).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!KindMusicExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostKindMusic([FromBody] KindMusic kindMusic) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.KindMusics.Add(kindMusic); await _context.SaveChangesAsync(); return(CreatedAtAction("GetKindMusic", new { id = kindMusic.KId }, kindMusic)); }