Esempio n. 1
0
 public ActionResult Index()
 {
     var model = new NewsViewModel()
     {
         News = nd.Get().ToList()
     };
     return View(model);
 }
Esempio n. 2
0
 public ActionResult Detail(int num)
 {
     var model = new NewsViewModel()
     {
         News =nd.Get().ToList().Where(a=>a.num == num)
     };
     return View(model);
 }
Esempio n. 3
0
        // GET: News
        public ActionResult Index()
        {
            int page = (Request.QueryString["page"] != null) ? Convert.ToInt32(Request.QueryString["page"]) : 1;
            double pagesize = 5, count = 0;
            int pagesort = (page - 1) * Convert.ToInt32(pagesize);
            count = Convert.ToDouble(nd.Get().ToList().Count);

            var model = new NewsViewModel()
            {
                News = nd.Get().ToList().OrderByDescending(a => a.wdate).Skip(pagesort).Take(Convert.ToInt32(pagesize)),
                page = page,
                Pages = Convert.ToInt32(Math.Ceiling(count / pagesize))
            };

            return View(model);
        }
        public ActionResult NewsEdit(int nid)
        {
            if (!CheckMemberlogin)
            {
                return RedirectToAction("login");
            }
            else
            {
                leftModel();
                var model = new NewsViewModel()
                {
                    news = nd.Get().ToList().Where(a => a.num == nid)
                };

                return View(model);
            }
        }