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