コード例 #1
0
        public ActionResult Category(long id, int page = 1, int pageSize = 8)
        {
            var category = new DocumentCategoryDao().ViewDetail(id);

            ViewBag.Category = category;
            int total = 0;
            var model = new DocumentDao().ListAllToPage(id, ref total, page, pageSize);

            ViewBag.Total = total;
            ViewBag.Page  = page;

            int maxPage   = 5;
            int totalPage = 0;

            totalPage = (int)Math.Ceiling((double)total / (double)pageSize);

            ViewBag.TotalPage = totalPage;
            ViewBag.MaxPage   = maxPage;
            ViewBag.First     = 1;
            ViewBag.Last      = totalPage;
            ViewBag.Next      = page + 1;
            ViewBag.Prev      = page - 1;

            return(View(model));
        }
コード例 #2
0
        public ActionResult Detail(long id)
        {
            var model    = new DocumentDao();
            var category = new DocumentCategoryDao();
            var document = model.ViewDetail(id);

            ViewBag.ListDocument = model.ListDocument(document.CategotyID, 4);
            ViewBag.ListCategory = category.ListAll();
            ViewBag.Category     = category.ViewDetail(document.CategotyID.Value);
            return(View(document));
        }
コード例 #3
0
        public ActionResult EditDocument(DocumentCategory docCate)
        {
            if (ModelState.IsValid)
            {
                var dao = new DocumentCategoryDao();

                var result = dao.Update(docCate);
                if (result)
                {
                    SetAlert("Edit User Successful!!", "success");
                    return(RedirectToAction("Index", "User"));
                }
                else
                {
                    ModelState.AddModelError("", "Update user not successfull!!");
                }
            }

            return(View("Index"));
        }
コード例 #4
0
        public ActionResult Create(DocumentCategory docCate)
        {
            if (ModelState.IsValid)
            {
                var dao = new DocumentCategoryDao();
                docCate.CreatedDate = DateTime.Now;
                docCate.ShowOnHome  = false;
                docCate.Status      = true;

                long id = dao.Insert(docCate);
                if (id > 0)
                {
                    SetAlert("Add User Successful!!", "success");
                    return(RedirectToAction("Index", "User"));
                }
                else
                {
                    ModelState.AddModelError("", "Add user not successfull!!");
                }
            }

            return(View("Index"));
        }
コード例 #5
0
        public void SetViewBag(long?selectedID = null)
        {
            var dao = new DocumentCategoryDao();

            ViewBag.CategotyID = new SelectList(dao.ListAll(), "ID", "Name", selectedID);
        }
コード例 #6
0
        public ActionResult DocumentCategory()
        {
            var model = new DocumentCategoryDao().ListAll();

            return(PartialView(model));
        }
コード例 #7
0
        public ActionResult EditDocument(long id)
        {
            var model = new DocumentCategoryDao().ViewDetail(id);

            return(View(model));
        }
コード例 #8
0
        // GET: Admin/DocumentCategory
        public ActionResult Index(int page = 1, int pageSize = 10)
        {
            var model = new DocumentCategoryDao().ListAllPaging(page, pageSize);

            return(View(model));
        }