Ejemplo n.º 1
0
        // GET: Faq
        public ActionResult Index(int?page,
                                  int pageSize = 10)
        {
            if (page == null)
            {
                page = 1;
            }

            int total;
            IEnumerable <FaqModel> query = Mapper.Map <IEnumerable <Faq>, IEnumerable <FaqModel> >(_faqService.GetMultiPaging(c => c.IsDisplay,
                                                                                                                              c => c.OrderByDescending(v => v.CreatedDate),
                                                                                                                              out total,
                                                                                                                              page ?? 1,
                                                                                                                              pageSize));

            ViewBag.Page      = page;
            ViewBag.Total     = total;
            ViewBag.TotalPage = total % pageSize == 0
                                    ? total / pageSize
                                    : total / pageSize + 1;
            ViewBag.List = query.ToList();
            return(View());
        }
Ejemplo n.º 2
0
        public ActionResult GetList(int offset,
                                    int limit)
        {
            int total;
            IEnumerable <FaqModel> query = Mapper.Map <IEnumerable <Faq>, IEnumerable <FaqModel> >(_faqService.GetMultiPaging(c => c.Id > 0,
                                                                                                                              c => c.OrderBy(v => v.Title)
                                                                                                                              .ThenByDescending(v => v.CreatedDate),
                                                                                                                              out total,
                                                                                                                              offset,
                                                                                                                              limit));

            return(Json(new FormatResult <FaqModel>(total,
                                                    query),
                        "json"));
        }