public ActionResult DeleteConfirmed(int id) { Ventes ventes = db.Ventes.Find(id); db.Ventes.Remove(ventes); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,ImageNom,ImageType,ImageTaille,ImageData,Prix,ContactInfo")] Ventes ventes) { if (ModelState.IsValid) { db.Entry(ventes).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(ventes)); }
//Ventes private void pictureBox9_Click(object sender, EventArgs e) { UserLine.Hide(); UnitesLine.Hide(); VentesLine.Show(); StatLine.Hide(); DisLine.Hide(); AchatsLine.Hide(); ProduitLine.Hide(); Ventes.BringToFront(); }
// GET: Ventes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Ventes ventes = db.Ventes.Find(id); if (ventes == null) { return(HttpNotFound()); } return(View(ventes)); }
public ActionResult Create([Bind(Include = "ID,ImageNom,ImageType,ImageTaille,ImageData,Prix,ContactInfo,Fichier,NomSkin")] Ventes ventes) { if (ModelState.IsValid) { ventes.ImageNom = Path.GetFileName(ventes.Fichier.FileName); ventes.ImageTaille = ventes.Fichier.ContentLength; ventes.ImageType = ventes.Fichier.ContentType; ventes.ImageData = new byte[ventes.ImageTaille]; ventes.Fichier.InputStream.Read(ventes.ImageData, 0, ventes.ImageTaille); db.Ventes.Add(ventes); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(ventes)); }
public HttpResponseMessage Get(DateTime debut, DateTime fin, int idPF) { ProduitRepository ProdRepo = new ProduitRepository(connexion); VendsRepository venteRepo = new VendsRepository(connexion); var result = ProdRepo.GetByDate(debut, fin, idPF); if (result == null) { return(Request.CreateResponse(HttpStatusCode.NotFound, "prod with ID: " + result.ToString() + "not found")); } var ventes = new Ventes(); foreach (var item in venteRepo.GetAll()) { int month = item.DateVente.Month; string prodName = ProdRepo.GetOne(item.IdProduit).NomProduit; double prodPrix = ProdRepo.GetOne(item.IdProduit).Prix; switch (prodName) { case "Marc": ventes.MarcCollectes[month] += prodPrix; break; case "Kit": ventes.Kit[month] += prodPrix; break; case "Fungipop": ventes.Fungipop[month] += prodPrix; break; default: break; } } var productions = new Productions(); foreach (var item in venteRepo.GetAll()) { int month = item.DateVente.Month; string prodName = ProdRepo.GetOne(item.IdProduit).NomProduit; double prodQuantite = ProdRepo.GetOne(item.IdProduit).Quantite; switch (prodName) { case "Marc": productions.Pleurottes[month] += prodQuantite; break; case "Kit": productions.Pieds[month] += prodQuantite; break; case "Fungipop": productions.Panicaults[month] += prodQuantite; break; default: break; } } var finalResult = new VenteEtProduction() { ventes = ventes, productions = productions }; return(Request.CreateResponse(HttpStatusCode.OK, finalResult)); }