Esempio n. 1
0
        public ActionResult Abonnement()
        {
            NewsContext db = new NewsContext();
            var data = db.Categories;

            return View(data);
        }
Esempio n. 2
0
        public ActionResult Abonnement(Subscriber abonne)
        {
            abonne.CreationDate = DateTime.Now;
            NewsContext db = new NewsContext();

            foreach (Category cat in db.Categories)
            {
                if (Request.Params[cat.CategoryName] != null)
                {
                    if (abonne.Categories == null)
                    {
                        abonne.Categories = new List<Category>();
                    }
                    abonne.Categories.Add(cat);
                }
            }
            db.Subscribers.Add(abonne);
            db.SaveChanges();

            return View("merci", abonne);
        }
 public GestionSubController(NewsContext ctx)
 {
     db = ctx;
 }
 public GestionSubController()
 {
     db = new NewsContext();
 }