Exemplo n.º 1
0
 public ActionResult Input(string id = "")
 {
     try
     {
         if (string.IsNullOrEmpty(id))
         {
             ViewBag.Title = "Create new Category";
             Category newCategory = new Category()
             {
                 CategoryID = 0
             };
             return(View(newCategory));
         }
         else
         {
             ViewBag.Title = "Edit a Category";
             Category editCategory = CataLogBLL.GetCategory(Convert.ToInt32(id));
             if (editCategory == null)
             {
                 return(RedirectToAction("Index"));
             }
             return(View(editCategory));
         }
     }
     catch (Exception ex)
     {
         return(Content(ex.Message + "" + ex.StackTrace));
     }
 }
Exemplo n.º 2
0
        // GET: Product
        /// <summary>
        /// trang chủ của sản phẩm
        /// </summary>
        /// <returns></returns>
        public ActionResult Index(int page = 1, string searchValue = "", int category = 1, int supplier = 1)
        {
            int            pageSize      = 3;
            int            rowCount      = 0;
            List <Product> listOfProduct = CataLogBLL.ListOfProduct(page, pageSize, searchValue, out rowCount, supplier, category);
            var            model         = new Models.ProductPaginationResult()
            {
                Page        = page,
                PageSize    = pageSize,
                RowCount    = rowCount,
                Data        = listOfProduct,
                SearchValue = searchValue,
                Supplier    = CataLogBLL.GetSupplier(supplier),
                Category    = CataLogBLL.GetCategory(category)
                              // Attribute = CataLogBLL.GetAttribute()
            };

            //  int pagesize = 3;
            // int rowcount = 0;
            // list<supplier> model = catalogbll.listofsupplier(page, pagesize, searchvalue, out rowcount);
            //  viewbag.rowcount = rowcount;
            return(View(model));
        }