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