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