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