示例#1
0
 // GET: contact
 public ActionResult Index()
 {
     var model = new ContactViewModel()
     {
         Address = addrd.Get().ToList()
     };
     return View(model);
 }
        public ActionResult Edit(int num, int m)
        {
            if (!CheckMemberlogin)
            {
                return RedirectToAction("login", "admin");
            }
            else
            {

                leftModel();

                conu.num = num;
                conu.isRead = 1;
                conud.Update_Read(conu);

                var model = new ContactViewModel()
                {
                    contact = conud.Get().ToList().Where(a => a.num == num).OrderByDescending(a => a.wdate),
                    product = prod.Get().ToList(),
                    productclass = proClassd.Get().ToList()
                };
                return View(model);

            }
        }
        public ActionResult Read(int page = 1)
        {
            if (!CheckMemberlogin)
            {
                return RedirectToAction("login", "admin");
            }
            else
            {
                leftModel();
                var currentpage = page < 1 ? 1 : page;
                var pagesize = 10;
                var cat = conud.Get().ToList().Where(a => a.isdel == 0).OrderByDescending(a => a.wdate).ThenByDescending(a => a.num);
                var model = new ContactViewModel()
                {
                    contact_pagelist = cat.ToPagedList(currentpage, pagesize)

                };

                return View(model);
            }
        }
        public ActionResult Read(int page = 1, string find1 = "", string find2 = "")
        {
            if (!CheckMemberlogin)
            {
                return RedirectToAction("login", "admin");
            }
            else
            {
                leftModel();
                ViewBag.searchResult = 0;
                ViewBag.search = 1;
                ViewBag.gowhere = Url.Action("Read", "adminContact");
                if (find1 != "" || find2 != "")
                {
                    ViewBag.searchResult = 1;
                    ViewBag.searchText = find1 + "," + find2;
                }
                var currentpage = page < 1 ? 1 : page;
                var pagesize = 10;
                var cat = cond.Get().ToList().Where(a => a.isdel == 0 && (a.uName.Contains(find1) || a.uPhone.Contains(find2))).OrderBy(a => a.sort);
                var model = new ContactViewModel()
                {
                    contact_pagelist = cat.ToPagedList(currentpage, pagesize)

                };

                return View(model);
            }
        }
示例#5
0
        public ActionResult ContactRead(int page = 1)
        {
            if (!CheckMemberlogin)
            {
                return RedirectToAction("login");
            }
            else
            {
                leftModel();
                var currentpage = page < 1 ? 1 : page;
                var pagesize = 10;
                var model = new ContactViewModel()
                {
                    Contact = ctd.Get().OrderByDescending(a => a.wdate).ToPagedList(currentpage, pagesize),
                    Address = addrd.Get().ToList()
                };

                return View(model);
            }
        }
示例#6
0
        public ActionResult ContactEdit(int num, int m, int addressNum)
        {
            if (!CheckMemberlogin)
            {
                return RedirectToAction("login");
            }
            else
            {
                leftModel();

                ct.num = num;
                ct.isRead = 1;
                ctd.Update_Read(ct);

                var model = new ContactViewModel()
                {
                    Contact_nopage = ctd.Get().ToList().Where(a => a.num == num).OrderByDescending(a => a.wdate),
                    Address = addrd.Get().ToList().Where(a => a.num == addressNum)
                };
                return View(model);

            }
        }