public ActionResult Create() { ProductManagerViewModel viewModel = new ProductManagerViewModel(); viewModel.Product = new Product(); viewModel.ProductCategories = productCategories.Collection(); return(View(viewModel)); }
public ActionResult Index(string Category = null) { List <Product> products; List <ProductCategory> categories = productCategories.Collection().ToList(); if (Category == null) { products = context.Collection().ToList(); } else { products = context.Collection().Where(x => x.Category == Category).ToList(); } ProductListViewModel model = new ProductListViewModel(); model.Product = products; model.ProductCategories = categories; return(View(model)); }
public ActionResult Index() { List <ProductCategory> productCategories = context.Collection().ToList(); return(View(productCategories)); }