// POST: odata/KazakhBests public async Task <IHttpActionResult> Post(KazakhBest kazakhBest) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.KazakhBests.Add(kazakhBest); await db.SaveChangesAsync(); return(Created(kazakhBest)); }
// DELETE: odata/KazakhBests(5) public async Task <IHttpActionResult> Delete([FromODataUri] int key) { KazakhBest kazakhBest = await db.KazakhBests.FindAsync(key); if (kazakhBest == null) { return(NotFound()); } db.KazakhBests.Remove(kazakhBest); await db.SaveChangesAsync(); return(StatusCode(HttpStatusCode.NoContent)); }
// PUT: odata/KazakhBests(5) public async Task <IHttpActionResult> Put([FromODataUri] int key, Delta <KazakhBest> patch) { Validate(patch.GetEntity()); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } KazakhBest kazakhBest = await db.KazakhBests.FindAsync(key); if (kazakhBest == null) { return(NotFound()); } patch.Put(kazakhBest); try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!KazakhBestExists(key)) { return(NotFound()); } else { throw; } } return(Updated(kazakhBest)); }