// 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));
 }
예제 #3
0
 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));
 }
예제 #4
0
 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));
 }
예제 #5
0
 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));
 }
예제 #7
0
 public void UpdateClient(Client clt)
 {
     db.Entry(clt).State = EntityState.Modified;
     db.SaveChanges();
 }