コード例 #1
0
 public ActionResult Products(int catid)
 {
     NorthwindDb db = new NorthwindDb(connectionString);
     Category category = db.GetCategoryById(catid);
     IEnumerable<Product> products = db.GetProductsForCategory(catid);
     ProductsViewModel viewModel = new ProductsViewModel();
     viewModel.Products = products;
     viewModel.Category = category;
     return View(viewModel);
 }
コード例 #2
0
 public ActionResult Categories()
 {
     NorthwindDb db = new NorthwindDb(connectionString);
     IEnumerable<Category> categories = db.GetAll();
     return View(categories);
 }