public IHttpActionResult Postview_Buyer_Orders(view_Buyer_Orders view_Buyer_Orders) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.view_Buyer_Orders.Add(view_Buyer_Orders); try { db.SaveChanges(); } catch (DbUpdateException) { if (view_Buyer_OrdersExists(view_Buyer_Orders.Order_ID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = view_Buyer_Orders.Order_ID }, view_Buyer_Orders)); }
public IHttpActionResult Putview_Buyer_Orders(string id, view_Buyer_Orders view_Buyer_Orders) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != view_Buyer_Orders.Order_ID) { return(BadRequest()); } db.Entry(view_Buyer_Orders).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!view_Buyer_OrdersExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Deleteview_Buyer_Orders(string id) { view_Buyer_Orders view_Buyer_Orders = db.view_Buyer_Orders.Find(id); if (view_Buyer_Orders == null) { return(NotFound()); } db.view_Buyer_Orders.Remove(view_Buyer_Orders); db.SaveChanges(); return(Ok(view_Buyer_Orders)); }