コード例 #1
0
 public ActionResult Index()
 {
     using (var db = new Models.ProductDB())
     {
         ViewBag.Message = "The number of products so far is " + db.products.Count().ToString();
     }
     return(View());
 }
コード例 #2
0
        public ActionResult Index()
        {
            //Models.Product p = new Models.Product();
            //p.Product_Code = "SOFT549";
            //p.Product_Name = "Book";

            using (var db = new Models.ProductDB())
            {
                //db.Products.Add(p);
                //db.SaveChanges();
                ViewBag.Message = "The number of products so far is " + db.Products.Count().ToString();
            }
            return(View());
        }