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