Beispiel #1
0
        public ActionResult Edit(string Id)
        {
            ProductCategory productCategory = context.Find(Id);

            if (productCategory == null)
            {
                return(HttpNotFound());
            }
            else
            {
                return(View(productCategory));
            }
        }
        public ActionResult Edit(string Id, HttpPostedFileBase file)
        {
            Product         product  = context.Find(Id);
            ProductCategory category = new ProductCategory();

            if (product == null)
            {
                return(HttpNotFound());
            }
            else
            {
                ProductManagerViewModel viewModel = new ProductManagerViewModel();
                viewModel.Product           = product;
                viewModel.ProductCategories = productCategories.Collection();
                return(View(viewModel));
            }
        }
Beispiel #3
0
        public ActionResult Details(string Id)
        {
            Product product = context.Find(Id);

            if (product == null)
            {
                return(HttpNotFound());
            }
            else
            {
                return(View(product));
            }
        }
Beispiel #4
0
        private Basket GetBasket(HttpContextBase httpContext, bool createIfNull)
        {
            HttpCookie cookie = httpContext.Request.Cookies.Get(BasketSessionName);
            Basket     basket = new Basket();

            if (cookie != null)
            {
                string basketId = cookie.Value;
                if (!string.IsNullOrEmpty(basketId))
                {
                    basket = basketContext.Find(basketId);
                }
                else
                {
                    if (createIfNull)
                    {
                        basket = CreateNewBasket(httpContext);
                    }
                }
            }
            return(basket);
        }