public ActionResult Index(int? kind)
        {
            worksViewModel model = null;

            int page = (Request.QueryString["page"] != null) ? Convert.ToInt32(Request.QueryString["page"]) : 1;
            double pagesize = 6, count = 0;
            int pagesort = (page - 1) * Convert.ToInt32(pagesize);

            if (kind != null)
            {
                count = Convert.ToDouble(wd.Get().ToList().Where(a => a.kind == kind && a.isdel == 0).Count());
                model = new worksViewModel()
                {
                    works = wd.Get().ToList().Where(a => a.kind == kind && a.isdel == 0).OrderBy(a => a.sort).Skip(pagesort).Take(Convert.ToInt32(pagesize)),
                    worksClass = wcd.Get().ToList(),
                    page = page,
                    pages = Convert.ToInt32(Math.Ceiling(count / pagesize))
                };
            }
            else
            {
                count = Convert.ToDouble(wd.Get().Where(a => a.isdel == 0).ToList().Count());
                model = new worksViewModel()
                {
                    works = wd.Get().ToList().Where(a=> a.isdel == 0).OrderBy(a => a.sort).Skip(pagesort).Take(Convert.ToInt32(pagesize)),
                    worksClass = wcd.Get().ToList(),
                    page = page,
                    pages = Convert.ToInt32(Math.Ceiling(count / pagesize))
                };

            }

            return View(model);
        }
 public ActionResult Detail(int num, int kind)
 {
     var model = new worksViewModel()
     {
         works = wd.Get().ToList().Where(a => a.num == num && a.isdel == 0).OrderBy(a => a.sort),
         worksClass = wcd.Get().ToList()
     };
     return View(model);
 }
        public ActionResult Add()
        {
            if (!CheckMemberlogin)
            {
                return RedirectToAction("login", "admin");
            }
            else
            {
                leftModel();
                var model = new worksViewModel()
                {
                    worksClass = gacd.Get().ToList().Where(a => a.isdel == 0 && a.root == 0).OrderBy(a => a.sort)
                };
                return View(model);

            }
        }
        public ActionResult Edit(int cl = 0)
        {
            if (!CheckMemberlogin)
            {
                return RedirectToAction("login", "admin");
            }
            else
            {
                leftModel();

                var model = new worksViewModel()
                {
                    worksClass = gacd.Get().ToList().OrderBy(a => a.sort),
                    cl = cl
                };

                return View(model);
            }
        }
        public ActionResult Read(int page = 1, string find1 = "")
        {
            if (!CheckMemberlogin)
            {
                return RedirectToAction("login", "admin");
            }
            else
            {
                leftModel();
                ViewBag.searchResult = 0;
                ViewBag.search = 1;
                ViewBag.gowhere = Url.Action("Read", "adminWorks");
                if (find1 != "")
                {
                    ViewBag.searchResult = 1;
                    ViewBag.searchText = find1;
                }
                var currentpage = page < 1 ? 1 : page;
                var pagesize = 10;

                var order = gad.Get().ToList().Where(a => a.isdel == 0 && a.name.Contains(find1));
                var model = new worksViewModel()
                {
                    works_pagelist = order.ToPagedList(currentpage, pagesize),
                    worksClass = gacd.Get().ToList().Where(a => a.isdel == 0 && a.root == 0)

                };
                return View(model);
            }
        }