コード例 #1
0
 public ActionResult Index()
 {
     var model = new MemberViewModel()
     {
         member = md.Get().ToList()
     };
     return View(model);
 }
コード例 #2
0
        public ActionResult Index()
        {
            if (Session["Account"] != null)
            {
                var data = md.Get().ToList().Where(a => a.uAccount == Session["Account"].ToString()).SingleOrDefault();
                Session["memberName"] = data.uName;

                var model = new MemberViewModel()
                {
                    member = md.Get().ToList().Where(a => a.uAccount == Session["Account"].ToString())
                };
                return View(model);
            }
            else
            {
                return RedirectToAction("Index", "login", new { m = 7 });
            }
        }
コード例 #3
0
        public ActionResult tracking()
        {
            if (Session["Account"] != null)
            {
                MemberViewModel model = null;

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

                var mdata = md.Get().ToList().Where(a => a.uAccount == Session["Account"].ToString()).SingleOrDefault();

                count = Convert.ToDouble(td.Get().ToList().Where(a => a.isdel == 0 && a.memberID == mdata.num).Count());
                model = new MemberViewModel()
                {
                    product = pd.Get().ToList().Where(a=>a.isdel == 0),
                    tracking = td.Get().ToList().Where(a => a.isdel == 0 && a.memberID == mdata.num).Skip(pagesort).Take(Convert.ToInt32(pagesize)),
                    page = page,
                    pages = Convert.ToInt32(Math.Ceiling(count / pagesize))
                };

                return View(model);
            }
            else
            {
                return RedirectToAction("Index", "login", new { m = 7 });
            }
        }
コード例 #4
0
        public ActionResult Edit(int num)
        {
            if (!CheckMemberlogin)
            {
                return RedirectToAction("login", "admin");
            }
            else
            {
                leftModel();
                var model = new MemberViewModel()
                {
                    member = md.Get().ToList().Where(a=>a.num == num)
                };

                return View(model);
            }
        }
コード例 #5
0
        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", "adminMember");
                if (find1 != "")
                {
                    ViewBag.searchResult = 1;
                    ViewBag.searchText = find1;
                }
                var currentpage = page < 1 ? 1 : page;
                var pagesize = 10;
                var pro = md.Get().ToList().Where(a => a.isdel == 0 && (a.uName.Contains(find1) || a.uAccount.Contains(find1))).OrderBy(a => a.sort);
                var model = new MemberViewModel()
                {
                    member_pagelist = pro.ToPagedList(currentpage, pagesize)

                };

                return View(model);
            }
        }