public IHttpActionResult PutDetails_commande(int id, Details_commande details_commande) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != details_commande.Id) { return(BadRequest()); } db.Entry(details_commande).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Details_commandeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetDetails_commande(int id) { Details_commande details_commande = db.Details_commande.Find(id); if (details_commande == null) { return(NotFound()); } return(Ok(details_commande)); }
public IHttpActionResult PostDetails_commande(Details_commande details_commande) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Details_commande.Add(details_commande); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = details_commande.Id }, details_commande)); }
public IHttpActionResult DeleteDetails_commande(int id) { Details_commande details_commande = db.Details_commande.Find(id); if (details_commande == null) { return(NotFound()); } db.Details_commande.Remove(details_commande); db.SaveChanges(); return(Ok(details_commande)); }
public OrderDetailsModel(Details_commande obj, Commandes order, Produits product) { this.Id = obj.Id; this.Quantity = obj.Quantity; this.TotalPrice = obj.TotalPrice; this.ProduitsId = obj.ProduitsId; this.CommandesId = obj.CommandesId; this.Sub_total = obj.Sub_total; this.Order = new OrderModel(order, order.status); this.Product = new ProductModel(product, from i in product.Images select new ImagesModel(i), from r in product.reviews select new ReviewsModel(r) ); }