public async Task <IHttpActionResult> PuttOrderType(int id, tOrderType OrderType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != OrderType.ID) { return(BadRequest()); } db.Entry(OrderType).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!tOrderTypeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GettOrderType(int id) { tOrderType tOrderType = await db.tOrderTypes.FindAsync(id); if (tOrderType == null) { return(NotFound()); } return(Ok(tOrderType)); }
public async Task <IHttpActionResult> PosttOrderType(tOrderType OrderType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tOrderTypes.Add(OrderType); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = OrderType.ID }, OrderType)); }
public async Task <IHttpActionResult> DeletetOrderType(int id) { tOrderType tOrderType = await db.tOrderTypes.FindAsync(id); if (tOrderType == null) { return(NotFound()); } db.tOrderTypes.Remove(tOrderType); await db.SaveChangesAsync(); return(Ok(tOrderType)); }