Example #1
0
        public ActionResult Search([Bind(Include = "TypeId, Name")] SysDMPublicSearchModel sysdmpublic,int id, int? page)
        {
            if (id == 0)
            {
                return RedirectToAction("Index", "DanhMuc", new { Area = "Admin" });
            }

            if (string.IsNullOrEmpty(sysdmpublic.Name))
                return RedirectToAction("Index", new { id = sysdmpublic.TypeId });

            int pagenum = 0;
            int pageCount = 0;
            if (!String.IsNullOrEmpty(Convert.ToString(page)))
            {
                pagenum = page.Value;
            }
            else pagenum = 1;
            sysdmpublic.TypeId = id;
            List<SysDMPublicModel> value = iSysDMPublicBussiness.searchModel(sysdmpublic, pagenum, 2, out pageCount);
            ViewBag.Page = pagenum;
            ViewBag.PageCount = pageCount;
            ViewBag.DmTypeId = id;
            ViewBag.SearchModel = sysdmpublic;
            Session[Constants.Application.Session.ModelSearch] = sysdmpublic;
            SysDMTypeBussiness dbDanhMuc = new SysDMTypeBussiness();
            ViewBag.lstDanhMuc = dbDanhMuc.getAll();
            return View("Index", value);
        }
Example #2
0
        // GET: /Admin/DanhMuc/
        public ActionResult Index(int? id, string page = "")
        {
            ViewBag.DmTypeId = id;
            //check xem co id loai danh muc khong
            // neu khong co tra ve index loai danh muc
            if(id == null || id == 0)
            {
                return RedirectToAction("Index", "DanhMuc", new { Area = "Admin" });
            }

            //xu ly phan trang
            int pagenum = 0;
            if (!String.IsNullOrEmpty(page))
            {
                pagenum = int.Parse(page.Replace('/', '\0'));
            }
            else pagenum = 1;
            int pageCount = 0;
            var value = iSysDMPublicBussiness.getAllModelByTypeId(id.Value, pagenum, 2, out pageCount);
            ViewBag.Page = pagenum;
            ViewBag.PageCount = pageCount;
            SysDMTypeBussiness dbDanhMuc = new SysDMTypeBussiness();
            ViewBag.lstDanhMuc = dbDanhMuc.getAll();
            return View(value);
        }