public async Task<IHttpActionResult> PostMovieCreditResult(MovieCreditResult movieCreditResult) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.MovieCreditResults.Add(movieCreditResult); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (MovieCreditResultExists(movieCreditResult.ItemId)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = movieCreditResult.ItemId }, movieCreditResult); }
public async Task<IHttpActionResult> PutMovieCreditResult(int id, MovieCreditResult movieCreditResult) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != movieCreditResult.ItemId) { return BadRequest(); } db.Entry(movieCreditResult).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MovieCreditResultExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }