private BlogComponentViewModel Excute(string keyword, int?pageSize, string sortOrder, string sortBy, int pageIndex = 1) { BlogComponentViewModel blogComponentViewModel = new BlogComponentViewModel(); // ViewData["BodyClass"] = "shop_grid_full_width_page"; var isNotPageSize = pageSize == null; if (isNotPageSize) { pageSize = _configuration.GetValue <int>("PageSize"); } blogComponentViewModel.PageSize = pageSize; blogComponentViewModel.SortType = sortBy; blogComponentViewModel.Data = _blogService.GetAllPaging(keyword, pageIndex, pageSize.Value, sortBy, sortOrder); blogComponentViewModel.Keyword = keyword; return(blogComponentViewModel); }
public async Task <IViewComponentResult> InvokeAsync(string search) { var currentUser = await this.userManager.GetUserAsync(this.HttpContext.User); BlogComponentViewModel components = new BlogComponentViewModel { RecentPosts = await this.blogComponentService.ExtractRecentPosts(currentUser), TopCategories = this.blogComponentService.ExtractTopCategories(), TopPosts = await this.blogComponentService.ExtractTopPosts(currentUser), TopTags = this.blogComponentService.ExtractTopTags(), RecentComments = await this.blogComponentService.ExtractRecentComments(currentUser), Search = search, }; return(this.View(components)); }