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