public ActionResult Index(string key, int?page)
        {
            try
            {
                ViewBag.statusCatg      = _loadCombo.InitSelectListItemStatusCreateCategory();
                ViewBag.PromotionListID = _loadCombo.InitSelectListItemStatusNewsGroup();
                List <LoadDropdown.DropdowCate> listDropdowCate = new List <LoadDropdown.DropdowCate>();
                ViewBag.parent = _loadCombo.SearchCategoryByName(ref listDropdowCate);

                ViewData["status"] = true;
                ViewData["key"]    = key;
                int            currentPageIndex = page.HasValue ? page.Value : 1;
                List <Catalog> listcate         = new List <Catalog>();
                var            listobj          = _catalogsBusiness.SearchCategoryByName(ListCate);
                //    var list = _catalogsBusiness.GetDynamicQuery().ToList().ToPagedList(currentPageIndex, 20);
                var list = listobj.ToPagedList(currentPageIndex, 20);

                return(View(list));
            }
            catch (FaultException ex)
            {
                var    exep    = Function.GetExeption(ex);
                var    codeExp = exep[1];
                string url     = "Error/ErrorFunction/" + codeExp;
                return(RedirectToActionPermanent(url));
            }
        }
Beispiel #2
0
        //
        // GET: /Manage/News/
        public ActionResult Index(string key, int?page)
        {
            try
            {
                ViewBag.statusCatg = _loadCombo.InitSelectListItemStatusNews();
                List <LoadCombo.DropdowNews> listDropdowNews = new List <LoadCombo.DropdowNews>();
                ViewBag.parent   = _loadCombo.SearchNewsByName(ref listDropdowNews);
                ViewBag.IsPublic = _loadCombo.IsPublicForNewsGroup();

                //ListGroup from name of group
                ViewBag.listGroupNewsGroupWithNamme = _loadCombo.InitSelectListItemStatusNewsGroup();

                ViewData["status"] = true;
                ViewData["key"]    = key;
                int currentPageIndex = page.HasValue ? page.Value : 1;

                var list = _newsBusines.GetByKey(key).OrderByDescending(p => p.ModifyDate).ToPagedList(currentPageIndex, 20);

                return(View(list));
            }
            catch (FaultException ex)
            {
                var    exep    = Function.GetExeption(ex);
                var    codeExp = exep[1];
                string url     = "Error/ErrorFunction/" + codeExp;
                return(RedirectToActionPermanent(url));
            }
        }