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