public async Task <IActionResult> PutArtist(int id, Artist artist) { if (id != artist.Id) { return(BadRequest()); } _context.Entry(artist).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ArtistExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Artist> > PostArtist(Artist artist) { _context.Artists.Add(artist); await _context.SaveChangesAsync(); return(CreatedAtAction("GetArtist", new { id = artist.Id }, artist)); }