Exemple #1
0
        public async Task <IActionResult> Index(SearchConditionParams query)
        {
            try
            {
                ViewBag.keywords = query.KeyWords?.Trim();
                ViewBag.IsNull   = query.ExistNull;
                int counts = await _docService.GetRecordCounts(query);

                var tables = await _docService.GetTables(query);

                foreach (var tb in tables)
                {
                    tb.FieldInfos = await _docService.GetFields(tb.Id);
                }
                PagerOption pageOptions = new PagerOption()
                {
                    ItemCount = counts,
                    PageSize  = query.PageSize, //5
                    PageIndex = query.PageIndex,
                    CountNum  = 5,
                    Url       = Request.Path.Value,
                    Query     = Request.Query,
                };
                ViewBag.Option     = pageOptions;
                ViewBag.TotalCount = counts;
                return(View(tables));
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
            return(View());
        }
Exemple #2
0
        public async Task <IActionResult> Pictures([FromQuery] int index)
        {
            var options = new PagerOption
            {
                PageIndex = index,
                PageSize  = 6,
            };
            var result = await _pictureService.GetPagerAsync(options.PageIndex, options.PageSize);

            options.Total   = result.total;
            ViewBag.Options = options;
            return(View(result.rows));
        }
        public async Task <IActionResult> Index(int pageIndex = 1)
        {
            var posts = await _repository.FindAsync <Post, DateTime>(t => t.IsPublished, t => t.PubDate, int.Parse(_config["blog:pageSize"]), pageIndex, out int count);

            var pageOption = new PagerOption
            {
                PageIndex  = pageIndex,
                PageSize   = int.Parse(_config["blog:pageSize"]),
                TotalCount = count,
                RouteUrl   = "/"
            };

            ViewBag.PagerOption = pageOption;

            return(View(posts));
        }
        public async Task <IActionResult> GalleryManage(int pageIndex = 1)
        {
            var galleries = await _repository.FindAsync <Gallery, DateTime>(t => true, t => t.PubDate, int.Parse(_config["blog:pageSize"]), pageIndex, out int count);

            var pageOption = new PagerOption
            {
                PageIndex  = pageIndex,
                PageSize   = int.Parse(_config["blog:pageSize"]),
                TotalCount = count,
                RouteUrl   = "/Admin/GalleryManage"
            };

            ViewBag.PagerOption = pageOption;

            return(View(galleries));
        }
        public async Task <IActionResult> Archives(int pageIndex = 1)
        {
            int pageSize = 20;

            var posts = await _repository.FindAsync <Post, DateTime>(t => t.IsPublished, t => t.PubDate, pageSize, pageIndex, out int count);

            var pageOption = new PagerOption
            {
                PageIndex  = pageIndex,
                PageSize   = pageSize,
                TotalCount = count,
                RouteUrl   = "/archives"
            };

            ViewBag.PagerOption = pageOption;

            return(View(posts));
        }
        public async Task <IActionResult> CommentManage(int pageIndex = 1)
        {
            int pageSize = 10;

            var comments = await _repository.FindAsync <Comment, DateTime>(t => true, t => t.PubDate, pageSize, pageIndex, out int count);

            var pageOption = new PagerOption
            {
                PageIndex  = pageIndex,
                PageSize   = pageSize,
                TotalCount = count,
                RouteUrl   = "/Admin/CommentManage"
            };

            ViewBag.PagerOption = pageOption;

            return(View(comments));
        }
Exemple #7
0
        public IActionResult Index(SearchConditionParams query)
        {
            ViewBag.keywords = query.KeyWords?.Trim();
            ViewBag.IsNull   = query.ExistNull;
            int         counts      = 0;
            var         tables      = GetTables(out counts, query.PageIndex, query.PageSize, query.KeyWords, query.ExistNull);
            PagerOption pageOptions = new PagerOption()
            {
                ItemCount = counts,
                PageSize  = query.PageSize, //5
                PageIndex = query.PageIndex,
                CountNum  = 5,
                Url       = Request.Path.Value,
                Query     = Request.Query,
            };

            ViewBag.Option     = pageOptions;
            ViewBag.TotalCount = counts;
            return(View(tables));
        }
        public async Task <IActionResult> Search2(string category, int pageIndex = 1)
        {
            var query = from galleries in _repository.All <Gallery>()
                        join categories in _repository.All <Category>()
                        on galleries.ID equals categories.SourceID
                        where categories.Text == category && galleries.IsPublished
                        select galleries;

            var count = await query.GroupBy(t => t.ID).CountAsync();

            var data = await query.Distinct().OrderByDescending(t => t.PubDate).Skip((pageIndex - 1) * int.Parse(_config["blog:pageSize"])).Take(int.Parse(_config["blog:pageSize"])).ToListAsync();

            var pageOption = new PagerOption
            {
                PageIndex  = pageIndex,
                PageSize   = int.Parse(_config["blog:pageSize"]),
                TotalCount = count,
                RouteUrl   = $"/search/{category}"
            };

            ViewBag.PagerOption = pageOption;

            return(View("Photos", data));
        }