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 = context.Collection().ToList();

            List <ProductCategory> categories = productCategories.Collection().ToList();

            if (Category == null)
            {
                context.Collection().ToList();
            }
            else
            {
                products = context.Collection().Where(p => p.Category == Category).ToList();
            }

            ProductListViewModel model = new ProductListViewModel();

            model.Products          = products;
            model.ProductCategories = categories;

            return(View(model));
        }
Exemple #3
0
        public List <BasketItemViewModel> GetBasketItems(HttpContextBase httpContext)
        {
            Basket basket = GetBasket(httpContext, false);

            if (basket != null)
            {
                var results = (from b in basket.BasketItems
                               join p in productContext.Collection() on b.ProductId equals p.Id
                               select new BasketItemViewModel()
                {
                    Id = b.Id,
                    Quanity = b.Quanity,
                    ProductName = p.Name,
                    Image = p.Image,
                    Price = p.Price
                }).ToList();
                return(results);
            }
            else
            {
                return(new List <BasketItemViewModel>());
            }
        }
Exemple #4
0
        // GET: ProductManager
        public ActionResult Index()
        {
            List <ProductCategory> productCategories = context.Collection().ToList();

            return(View(productCategories));
        }