public ActionResult Index(int kind = 0)
        {
            dressdesignViewModel model = null;
            int page = (Request.QueryString["page"] != null) ? Convert.ToInt32(Request.QueryString["page"]) : 1;

            double pagesize = 12, count = 0;
            int pagesort = (page - 1) * Convert.ToInt32(pagesize);

            if (kind != 0)
            {
                count = Convert.ToDouble(dred.Get().ToList().Where(a => a.kind == kind).Count());
                model = new dressdesignViewModel()
               {
                   dressdesign_nopage = dred.Get().ToList().Where(a => a.kind == kind).OrderBy(a => a.sort).Skip(pagesort).Take(Convert.ToInt32(pagesize)),
                   dressdesignClass = drecd.Get().ToList(),
                   page = page,
                   pages = Convert.ToInt32(Math.Ceiling(count / pagesize)),
                   kind = kind
               };
            }
            else
            {
                count = Convert.ToDouble(dred.Get().ToList().Count());
                model = new dressdesignViewModel()
                {
                    dressdesign_nopage = dred.Get().ToList().OrderBy(a => a.sort).Skip(pagesort).Take(Convert.ToInt32(pagesize)),
                    dressdesignClass = drecd.Get().ToList(),
                    page = page,
                    pages = Convert.ToInt32(Math.Ceiling(count / pagesize))

                };
            }
            return View(model);
        }
Example #2
0
        public ActionResult dressdesignClassEdit(int cl = 0)
        {
            if (!CheckMemberlogin)
            {
                return RedirectToAction("login");
            }
            else
            {
                leftModel();

                var model = new dressdesignViewModel()
                {
                    dressdesignClass = drecd.Get().ToList().OrderBy(a => a.sort),
                    cl = cl
                };

                return View(model);
            }
        }
Example #3
0
        public ActionResult dressdesignEdit(int num)
        {
            if (!CheckMemberlogin)
            {
                return RedirectToAction("login");
            }
            else
            {
                leftModel();
                var model = new dressdesignViewModel()
                {
                    dressdesign_nopage = dred.Get().ToList().Where(a => a.num == num),
                    dressdesignClass = drecd.Get().ToList().OrderBy(a => a.sort)
                };

                return View(model);
            }
        }
Example #4
0
        //攝影作品
        public ActionResult dressdesignRead(int page = 1)
        {
            if (!CheckMemberlogin)
            {
                return RedirectToAction("login");
            }
            else
            {
                leftModel();
                var currentpage = page < 1 ? 1 : page;
                var pagesize = 10;
                var model = new dressdesignViewModel()
                {
                    dressdesign = dred.Get().Where(a => a.isdel == 0).OrderBy(a => a.sort).ToPagedList(currentpage, pagesize),
                    dressdesignClass = drecd.Get().ToList()
                };

                return View(model);
            }
        }