Ejemplo n.º 1
0
 public ActionResult Edit(string id)
 {
     SinglePageModel model = new SinglePageModel();
     model.SinglePage = singlePageService.GetSingPageById(id);
     if (model.SinglePage == null)
     {
         model.SinglePage = new SinglePage();
     };
     return View(model);
 }
Ejemplo n.º 2
0
 public ActionResult SensitiveWords(string id)
 {
     SinglePageModel model = new SinglePageModel();
     SinglePageService singlePageService = new SinglePageService();
     model.SinglePage = singlePageService.GetSingPageById(id);
     return View(model);
 }
Ejemplo n.º 3
0
        public ActionResult Index(string id)
        {
            SinglePageModel model = new SinglePageModel();

            int page = 1;
            if (!string.IsNullOrEmpty(id))
            {
                Int32.TryParse(id, out page);
            }

            try
            {
                int newsCount = 0;
                model.SinglePages = singlePageService.GetSinglePages(EnumEntityType.News.ToString(), null, true, 20, page, out newsCount);
                //分页
                if (model.SinglePages != null && model.SinglePages.Count > 0)
                {
                    model.PageIndex = page;//当前页数
                    model.PageSize = 20;//每页显示多少条
                    model.PageStep = 10;//每页显示多少页码
                    model.AllCount = newsCount;
                    if (model.AllCount % model.PageSize == 0)
                    {
                        model.PageCount = model.AllCount / model.PageSize;
                    }
                    else
                    {
                        model.PageCount = model.AllCount / model.PageSize + 1;
                    }
                }
            }
            catch (Exception e)
            {
                LogService.Log("新闻列表", e.ToString());
            }
            return View(model);
        }