示例#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));
            }
        }
示例#3
0
        public ActionResult Details(string Id)
        {
            Product product = context.Find(Id);

            if (product == null)
            {
                return(HttpNotFound());
            }
            else
            {
                return(View(product));
            }
        }
示例#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);
        }