public async Task <IHttpActionResult> PostPlumShapedFlexibleCoup(PlumShapedFlexibleCoup plumShapedFlexibleCoup) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PlumShapedFlexibleCouplings.Add(plumShapedFlexibleCoup); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (PlumShapedFlexibleCoupExists(plumShapedFlexibleCoup.TypeID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = plumShapedFlexibleCoup.TypeID }, plumShapedFlexibleCoup)); }
public async Task <IHttpActionResult> PutPlumShapedFlexibleCoup(string id, PlumShapedFlexibleCoup plumShapedFlexibleCoup) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != plumShapedFlexibleCoup.TypeID) { return(BadRequest()); } db.Entry(plumShapedFlexibleCoup).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlumShapedFlexibleCoupExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetPlumShapedFlexibleCoup(string id) { PlumShapedFlexibleCoup plumShapedFlexibleCoup = await db.PlumShapedFlexibleCouplings.FindAsync(id); if (plumShapedFlexibleCoup == null) { return(NotFound()); } return(Ok(plumShapedFlexibleCoup)); }
public async Task <IHttpActionResult> DeletePlumShapedFlexibleCoup(string id) { PlumShapedFlexibleCoup plumShapedFlexibleCoup = await db.PlumShapedFlexibleCouplings.FindAsync(id); if (plumShapedFlexibleCoup == null) { return(NotFound()); } db.PlumShapedFlexibleCouplings.Remove(plumShapedFlexibleCoup); await db.SaveChangesAsync(); return(Ok(plumShapedFlexibleCoup)); }