public async Task <IHttpActionResult> PostinDesign(inDesign inDesign) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.inDesigns.Add(inDesign); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (inDesignExists(inDesign.JobID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = inDesign.JobID }, inDesign)); }
public async Task <IHttpActionResult> PutinDesign(int id, inDesign inDesign) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != inDesign.JobID) { return(BadRequest()); } db.Entry(inDesign).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!inDesignExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetinDesign(int id) { inDesign inDesign = await db.inDesigns.FindAsync(id); if (inDesign == null) { return(NotFound()); } return(Ok(inDesign)); }
public async Task <IHttpActionResult> DeleteinDesign(int id) { inDesign inDesign = await db.inDesigns.FindAsync(id); if (inDesign == null) { return(NotFound()); } db.inDesigns.Remove(inDesign); await db.SaveChangesAsync(); return(Ok(inDesign)); }