//
 // GET: /Product/
 public ActionResult Categories()
 {
     using (var context = new AdventureWorks2012Context())
     {
         var categories = context.ProductCategories.ToList();
         return PartialView(categories);
     }
 }
예제 #2
0
 private static void Fill(GraphClient graphClient)
 {
     using (var context = new AdventureWorks2012Context())
     {
         foreach (var product in context.Products)
         {
             graphClient.Create(new Product {ProductId = product.ProductID});
         }
     }
 }
        public ActionResult Widget(int productId)
        {
            using (var context = new AdventureWorks2012Context())
            {
                var product = context.Products
                    .Include("ProductModel.ProductModelProductDescriptionCultures.ProductDescription")
                    .Single(c => c.ProductID == productId);

                return PartialView(product);
            }
        }
        public ActionResult List(int productSubcategoryId)
        {
            using (var context = new AdventureWorks2012Context())
            {
                var subcategory = context.ProductSubcategories
                    .Include("Products")
                    .Single(c => c.ProductSubcategoryID == productSubcategoryId);

                return View(subcategory);
            }
        }
예제 #5
0
        public ActionResult AddItem(int productId)
        {
            using (var context = new AdventureWorks2012Context())
            {
                var product = context.Products.Single(p => p.ProductID == productId);
                var cart = GetCart();

                cart.IncrementQuantity(product);

                Session["Cart"] = cart;

                return Redirect(Request.UrlReferrer.ToString());
            }
        }