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