public async Task <IHttpActionResult> PostFlexiblePinCoup(FlexiblePinCoup flexiblePinCoup) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.FlexiblePinCouplings.Add(flexiblePinCoup); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (FlexiblePinCoupExists(flexiblePinCoup.TypeID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = flexiblePinCoup.TypeID }, flexiblePinCoup)); }
public async Task <IHttpActionResult> PutFlexiblePinCoup(string id, FlexiblePinCoup flexiblePinCoup) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != flexiblePinCoup.TypeID) { return(BadRequest()); } db.Entry(flexiblePinCoup).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FlexiblePinCoupExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetFlexiblePinCoup(string id) { FlexiblePinCoup flexiblePinCoup = await db.FlexiblePinCouplings.FindAsync(id); if (flexiblePinCoup == null) { return(NotFound()); } return(Ok(flexiblePinCoup)); }
public async Task <IHttpActionResult> DeleteFlexiblePinCoup(string id) { FlexiblePinCoup flexiblePinCoup = await db.FlexiblePinCouplings.FindAsync(id); if (flexiblePinCoup == null) { return(NotFound()); } db.FlexiblePinCouplings.Remove(flexiblePinCoup); await db.SaveChangesAsync(); return(Ok(flexiblePinCoup)); }