// POST: odata/FinalBowlingScores public IHttpActionResult Post(FinalBowlingScore finalBowlingScore) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.FinalBowlingScores.Add(finalBowlingScore); db.SaveChanges(); return(Created(finalBowlingScore)); }
// DELETE: odata/FinalBowlingScores(5) public IHttpActionResult Delete([FromODataUri] int key) { FinalBowlingScore finalBowlingScore = db.FinalBowlingScores.Find(key); if (finalBowlingScore == null) { return(NotFound()); } db.FinalBowlingScores.Remove(finalBowlingScore); db.SaveChanges(); return(StatusCode(HttpStatusCode.NoContent)); }
// PUT: odata/FinalBowlingScores(5) public IHttpActionResult Put([FromODataUri] int key, Delta <FinalBowlingScore> patch) { Validate(patch.GetEntity()); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } FinalBowlingScore finalBowlingScore = db.FinalBowlingScores.Find(key); if (finalBowlingScore == null) { return(NotFound()); } patch.Put(finalBowlingScore); try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!FinalBowlingScoreExists(key)) { return(NotFound()); } else { throw; } } return(Updated(finalBowlingScore)); }