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