public ActionResult Sizes() { SizesViewModel svm = new SizesViewModel(); var repo = new ProductsRepository(); svm.Sizes = repo.AllSizes().ToList(); svm.Categories = repo.AllCategories().ToList(); return(View(svm)); }
public ActionResult EnterSizes(int pId) { var repo = new ProductsRepository(); EnterSizesViewModel esvm = new EnterSizesViewModel(); esvm.Product = repo.ProductByID(pId); esvm.Sizes = repo.AllSizes().Where(s => s.Categories.Any(c => c.CategoryID == esvm.Product.CategoryID)).ToList(); return(View(esvm)); }