コード例 #1
0
        // GET: Products/Details/5
        public ActionResult Details(int id)
        {
            ProductBLL product;

            try
            {
                using (ContextBll ctx = new ContextBll())
                {
                    product = ctx.FindProductByID(id);
                    if (null == product)
                    {
                        return(View("ItemNotFound"));
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.Exception = ex;
                return(View("Error"));
            }
            return(View(product));
        }
コード例 #2
0
        public ActionResult Purchase(int id)
        {
            ProductBLL Product;

            try
            {
                using (ContextBll ctx = new ContextBll())
                {
                    Product = ctx.FindProductByID(id);
                    if (null == Product)
                    {
                        return(View("ItemNotFound"));
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.Exception = ex;
                return(View("Error"));
            }

            return(View(new PurchaseModel(Product)));
        }
コード例 #3
0
        // GET: Products/Edit/5
        public ActionResult Edit(int id)
        {
            ProductBLL Product;

            try
            {
                using (ContextBll ctx = new ContextBll())
                {
                    Product = ctx.FindProductByID(id);
                    if (null == Product)
                    {
                        return(View("ItemNotFound"));
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.Exception = ex;
                return(View("Error"));
            }
            ViewBag.Product = GetCategorieItems();
            return(View(Product));
        }