public async Task <HttpResponseMessage> GetAllVente() { List <VenteModel> model = new List <VenteModel>(); try { venteService.GetVentes().ToList().ForEach(item => { VenteModel vent = new VenteModel { ID = item.ID, DATEVENTE = item.DATEVENTE, QUANTITY = item.QUANTITY, ID_PRODUCT = item.ID_PRODUCT, nomP = prodService.GetProduit(item.ID_PRODUCT.GetValueOrDefault()).NAMEP, PRIXVENTE = prodService.GetProduit(item.ID_PRODUCT.GetValueOrDefault()).PRIXVENTE, }; model.Add(vent); }); return(Request.CreateResponse(HttpStatusCode.OK, model)); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.BadRequest, ex)); } }
public ActionResult Vente() { VenteModel model = new VenteModel(); model.utilisateur = GetChefFromCookie(); model.ClientList = clientBusiness.getClients(); model.ProduitList = produitBusiness.getProduits2(); return(View(model)); }