public async Task <IActionResult> Index(int?categoryId, string s) { if (categoryId.HasValue) { ViewBag.activeCategory = categoryId; return(View(await _blogApiService.GetAllByCategoryIdAsync((int)categoryId))); } if (!string.IsNullOrWhiteSpace(s)) { ViewBag.search = s; return(View(await _blogApiService.Search(s))); } return(View(await _blogApiService.GetAllAsync())); }