Esempio n. 1
0
        public async Task <IActionResult> Show(string pageIndex, string id, DateTime FromDate, DateTime ToDate)
        {
            var listOfBlogs = _blogService.GetByParametars(id, FromDate, ToDate);

            //var list = _mapper.Map<List<BlogShowVM>>(listOfBlogs);

            var list = listOfBlogs.Select(x => new BlogShowVM
            {
                PublishedDate = x.PublishedDate,
                Summary       = x.Summary,
                Title         = x.Title
            }).AsNoTracking().OrderBy(x => x.PublishedDate);

            int?page = 1;

            if (pageIndex != null)
            {
                page = Int32.Parse(pageIndex);
            }

            var model = await PagingList.CreateAsync(list, 5, page ?? 1);

            return(PartialView(model));
        }