// GET: Abonnements public ActionResult Index() { checkAbonnements(); ViewBag.caisseDefined = db.Caisses.Any(); var abonnements = db.Operations.OfType <Abonnement>().Include(a => a.Forfait).OrderByDescending(a => a.Termine).OrderByDescending(l => l.Date).ToList(); foreach (var abonnement in abonnements) { if ((abonnement.DateFin - DateTime.Now).TotalDays < -1 && !abonnement.Suspendu) { abonnement.Termine = true; db.Entry(abonnement).State = EntityState.Modified; db.SaveChanges(); } } return(View(abonnements)); }
public ActionResult Edit([Bind(Include = "Id,Nom,Description")] GroupeForfait groupeForfait) { if (ModelState.IsValid) { db.Entry(groupeForfait).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(groupeForfait)); }
public ActionResult Edit([Bind(Include = "ID,Nom,Solde")] Caisse caisse) { if (ModelState.IsValid) { db.Entry(caisse).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(caisse)); }
public ActionResult Edit([Bind(Include = "Id,ProduitId,Type,Amount,Date")] StockLog stockLog) { if (ModelState.IsValid) { db.Entry(stockLog).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(stockLog)); }
public ActionResult Edit([Bind(Include = "Id,ProduitId,DateLocation,DateFinLocation,DateSuspensionLocation,DateArretLocation,LocationRendue,QuantitePrise,QuantiteRendue,Montant,Date,UserId")] Location location) { if (ModelState.IsValid) { db.Entry(location).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ProduitId = new SelectList(db.Produits, "ID", "Nom", location.ProduitId); return(View(location)); }
public ActionResult Edit([Bind(Include = "Id,EmailNotifications,HourNotifications")] Parametre parametre) { if (ModelState.IsValid) { db.Entry(parametre).State = EntityState.Modified; if (parametre.HourNotifications > 24) { parametre.HourNotifications = parametre.HourNotifications % 24; } db.SaveChanges(); RecurringJob.AddOrUpdate("notifications", () => Utilities.SendNotifications(), Cron.Daily(parametre.HourNotifications)); return(RedirectToAction("Index")); } return(View(parametre)); }
public void UpdateClient(Client clt) { db.Entry(clt).State = EntityState.Modified; db.SaveChanges(); }