public IHttpActionResult PutArtistGenre(long id, ArtistGenre artistGenre) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != artistGenre.artist_genre_id) { return BadRequest(); } db.InsertOrUpdate(artistGenre); try { db.Save(); } catch (DbUpdateConcurrencyException) { if (!ArtistGenreExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostArtistGenre(ArtistGenre artistGenre) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.InsertOrUpdate(artistGenre); db.Save(); return CreatedAtRoute("DefaultApi", new { id = artistGenre.artist_genre_id }, artistGenre); }