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