Ejemplo n.º 1
0
        public ActionResult Index2()
        {
            northwindEntities1 db    = new northwindEntities1();
            List <Products>    model = db.Products.ToList();

            db.Dispose();
            return(View(model));
        }
Ejemplo n.º 2
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         db.Dispose();
     }
     base.Dispose(disposing);
 }
Ejemplo n.º 3
0
 // GET: Products
 public ActionResult Index()
 {
     if (Session["UserName"] == null) // Tässä tarkastetaan onko käyttäjä kirjautunut sisään
     {
         return(RedirectToAction("login", "home"));
     }
     else
     {
         northwindEntities1 db    = new northwindEntities1();
         List <Products>    model = db.Products.ToList();
         db.Dispose();
         return(View(model));
     }
 }