예제 #1
0
        public ActionResult Detail(long ID)
        {
            ViewBag.Tags = Session["tag"];
            ViewBag.Cate = null;
            if (Session["tag"] == null)
            {
                var catID = Convert.ToInt64(Session["CategoryID"]);

                CategoryDao ctDao = new CategoryDao();
                ViewBag.Cate = ctDao.FindByID(catID);
                var items = GetClientCategoryViewModel();
                ViewBag.CatePare = items.Find(x => x.ID == catID);
            }
            else
            {
                ViewBag.Tags = Session["tag"];
            }


            NewsDao nDao   = new NewsDao();
            News    objNew = nDao.FindByID(ID);

            objNew.ViewCount = objNew.ViewCount + 1;
            nDao.Update(objNew);
            return(View(objNew));
        }
예제 #2
0
        public ActionResult Category(long cateId, int page = 1, int pageSize = 10)
        {
            CategoryDao ctDao = new CategoryDao();

            ViewBag.Cate = ctDao.FindByID(cateId);

            var items = GetClientCategoryViewModel();

            ViewBag.CatePare = items.Find(x => x.ID == cateId);

            var model       = new NewsDao().ListtiveByCateIDPaging(cateId, page, pageSize);
            int totalRecord = new NewsDao().ToActiveByCateID(cateId).Count();

            ViewBag.Total = totalRecord;
            ViewBag.Page  = page;

            int maxPage   = 5;
            int totalPage = 0;

            totalPage         = (int)Math.Ceiling((double)(totalRecord / pageSize)) + 1;
            ViewBag.TotalPage = totalPage;
            ViewBag.MaxPage   = maxPage;
            ViewBag.First     = 1;
            ViewBag.Last      = totalPage;
            ViewBag.Next      = page + 1;
            ViewBag.Prev      = page - 1;
            return(View(model));
        }
예제 #3
0
        public ActionResult Edit(long id)
        {
            var iplCategory = new CategoryDao();
            var model       = iplCategory.FindByID(id);

            return(View(model));
        }
예제 #4
0
        // GET: Category/Details/5
        public ActionResult Details(long id)
        {
            CategoryDao bdDao = new CategoryDao();
            var         sl    = bdDao.FindByID(id);

            if (sl.Status == true)
            {
                ViewBag.Status = "Kích hoạt";
            }
            else
            {
                ViewBag.Status = "Khóa";
            }
            return(View(sl));
        }
예제 #5
0
        // GET: Admin/Category/Details/5
        public ActionResult Details(long id)
        {
            CategoryDao dbDAO = new CategoryDao();
            Category    cat   = null;

            try
            {
                cat = dbDAO.FindByID(id);
            }
            catch
            {
                ModelState.AddModelError("", Resources.ResourceAdmin.ErrorGetRecordMessage);
            }
            return(View(cat));
        }
예제 #6
0
        public ActionResult Edit(long id)
        {
            CategoryDao dbDAO = new CategoryDao();
            Category    cat   = null;

            try
            {
                cat = dbDAO.FindByID(id);
                var items = GetClientCategoryViewModel();

                var objite = items.Find(x => x.ID == cat.CategoryID);
                items.Remove(objite);
                var dbContext = new DBContext();
                ViewBag.ParentID = new SelectList(items, "ID", "Text");
                // ViewBag.GroupID = new SelectList(dbContext..ToList(), "ID", "Name");
            }
            catch
            {
                ModelState.AddModelError("", Resources.ResourceAdmin.ErrorGetRecordMessage);
            }
            return(View(cat));
        }
예제 #7
0
        // GET: Category/Edit/5
        public ActionResult Edit(long id)
        {
            CategoryDao bdDao = new CategoryDao();

            return(View(bdDao.FindByID(id)));
        }