Ejemplo n.º 1
0
        public ActionResult Index()
        {
            IndexViewModel Model = new IndexViewModel();

            Model.LIST_PRODUCTS_NEW = TBL_PRODUCTS.LIST(ISACTIVE: true, ISACTIVE_CATEGORY: true, TOPNUMBER: 8);

            return(View(Model));
        }
Ejemplo n.º 2
0
        // GET: Product
        public ActionResult ProductList(int?ID = null)
        {
            ProductViewModel Model = new ProductViewModel();

            Model.LIST_PRODUCTS   = TBL_PRODUCTS.LIST(CATEGORYID: ID, ISACTIVE: true, ISACTIVE_CATEGORY: true);
            Model.LIST_CATEGORIES = TBL_CATEGORIES.LIST(ISACTIVE: true, ISPRODUCTCOUNT: true).OrderByDescending(x => x.PRODUCTCOUNT).ToList();
            if (ID > 0)
            {
                Model.SELECTEDCATEGORY = Model.LIST_CATEGORIES.Where(x => x.ID == ID).ToList()?[0].CATEGORYNAME ?? "";
            }
            return(View(Model));
        }
Ejemplo n.º 3
0
        public ActionResult ProductList()
        {
            ProductViewModel Model = new ProductViewModel();

            Model.List_PRODUCTS   = TBL_PRODUCTS.LIST();
            Model.List_CATEGORIES = TBL_CATEGORIES.LIST().ConvertAll(t =>
            {
                return(new SelectListItem()
                {
                    Text = t.CATEGORYNAME.ToString(),
                    Value = t.ID.ToString(),
                    Selected = false
                });
            });
            return(View(Model));
        }
Ejemplo n.º 4
0
        public ActionResult ProductDetail(int?ID = null)
        {
            if (ID == null)
            {
                return(RedirectToAction("ProductList"));
            }

            ProductViewModel Model = new ProductViewModel();

            try
            {
                Model.PRODUCTS = TBL_PRODUCTS.LIST(ID: ID, ISACTIVE: true, ISACTIVE_CATEGORY: true)[0];
            }
            catch (Exception ex)
            {
                LogManager.LogManagerStatic().LogError(ex.Message);

                return(RedirectToAction("ProductList"));
            }

            return(View(Model));
        }
Ejemplo n.º 5
0
        public ActionResult ProductList(string PRODUCTNAME = null, int CATEGORYID = -1)
        {
            ProductViewModel Model = new ProductViewModel();
            int?_categoryID        = null;

            if (CATEGORYID > 0)
            {
                _categoryID = CATEGORYID;
            }
            Model.List_PRODUCTS   = TBL_PRODUCTS.LIST(PRODUCTNAME: PRODUCTNAME, CATEGORYID: _categoryID);
            Model.List_CATEGORIES = TBL_CATEGORIES.LIST().ConvertAll(t =>
            {
                return(new SelectListItem()
                {
                    Text = t.CATEGORYNAME.ToString(),
                    Value = t.ID.ToString(),
                    Selected = false
                });
            });
            Model.CATEGORYID  = CATEGORYID;
            Model.PRODUCTNAME = PRODUCTNAME;
            return(View(Model));
        }