// POST: odata/mdCurrentTransformers public async Task <IHttpActionResult> Post(mdCurrentTransformer mdCurrentTransformer) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.mdCurrentTransformers.Add(mdCurrentTransformer); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (mdCurrentTransformerExists(mdCurrentTransformer.PrimaryEquipmentId)) { return(Conflict()); } else { throw; } } return(Created(mdCurrentTransformer)); }
// DELETE: odata/mdCurrentTransformers(5) public async Task <IHttpActionResult> Delete([FromODataUri] int key) { mdCurrentTransformer mdCurrentTransformer = await db.mdCurrentTransformers.FindAsync(key); if (mdCurrentTransformer == null) { return(NotFound()); } db.mdCurrentTransformers.Remove(mdCurrentTransformer); await db.SaveChangesAsync(); return(StatusCode(HttpStatusCode.NoContent)); }
// PUT: odata/mdCurrentTransformers(5) public async Task <IHttpActionResult> Put([FromODataUri] int key, Delta <mdCurrentTransformer> patch) { Validate(patch.GetEntity()); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } mdCurrentTransformer mdCurrentTransformer = await db.mdCurrentTransformers.FindAsync(key); if (mdCurrentTransformer == null) { return(NotFound()); } patch.Put(mdCurrentTransformer); try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!mdCurrentTransformerExists(key)) { return(NotFound()); } else { throw; } } return(Updated(mdCurrentTransformer)); }