Beispiel #1
0
        public ActionResult Products(int id)
        {
            if (id < 1)
            {
                return(HttpNotFound());
            }
            var op = new LoadProductsOperation(1, ConstV.ItemsPerPage, id);

            op.ExcecuteTransaction();
            if (!op.Success)
            {
                return(HttpNotFound());
            }

            var op2 = new LoadPagesDescOperation("menu", "index");

            op2.ExcecuteTransaction();
            var op3 = new LoadCategoriesOperation();

            op3.ExcecuteTransaction();
            var model = new MenuModel
            {
                PageDescription = op2._pageDescription,
                Categories      = op3._categories,
                Products        = op._products,
            };

            ViewBag.Main = false;
            return(View("Index", model));
        }
Beispiel #2
0
        public ActionResult Load(PageModel model)
        {
            if (model.PageNumber < 1)
            {
                return(Json(new { noElements = true }));
            }
            var operation = new LoadProductsOperation(model.PageNumber, ConstV.ItemsPerPage, model.CategoryId);

            operation.ExcecuteTransaction();
            if (operation._products == null || operation._products.Count == 0)
            {
                return(Json(new { noElements = true }));
            }
            return(PartialView("Menu/_listOfProducts", operation._products));
        }