public async Task <IActionResult> Result(string result, string category, int pageNumber = 1, int pageSize = 5)
        {
            int excludeRecords = (pageSize * pageNumber) - pageSize;

            this.ViewData["Result"]   = result;
            this.ViewData["Category"] = category;
            if (result == null)
            {
                result = string.Empty;
            }

            ListingNewsViewModel viewModel = new ListingNewsViewModel
            {
                News        = (await this.newsService.GetAll <NewsViewModel>()).Where(x => x.Title.ToLower().Contains(result.ToLower()) || x.Content.ToLower().Contains(result.ToLower())).OrderByDescending(x => x.CreatedOn).ToList(),
                CurrentPage = pageNumber,
            };

            if (category != "0")
            {
                NewsCategory newsCategory = (NewsCategory)Enum.Parse(typeof(NewsCategory), category);
                viewModel.News = viewModel.News.Where(x => x.Category == newsCategory);
            }

            int recordsCount = viewModel.News.Count();

            if (recordsCount % 5 == 0)
            {
                viewModel.PagesCount = recordsCount / 5;
            }
            else
            {
                viewModel.PagesCount = (recordsCount / 5) + 1;
            }

            viewModel.News = viewModel.News.Skip(excludeRecords).Take(pageSize).ToList();

            return(this.View(viewModel));
        }
        public async Task <IActionResult> Listing(int pageNumber = 1, int pageSize = 5)
        {
            int excludeRecords = (pageSize * pageNumber) - pageSize;
            int recordsCount   = (await this.newsService.GetAll <NewsViewModel>()).Count();

            ListingNewsViewModel viewModel = new ListingNewsViewModel
            {
                News        = (await this.newsService.GetAll <NewsViewModel>()).OrderByDescending(x => x.CreatedOn).ToList(),
                CurrentPage = pageNumber,
            };

            if (recordsCount % 5 == 0)
            {
                viewModel.PagesCount = recordsCount / 5;
            }
            else
            {
                viewModel.PagesCount = (recordsCount / 5) + 1;
            }

            viewModel.News = viewModel.News.Skip(excludeRecords).Take(pageSize).ToList();

            return(this.View(viewModel));
        }