public async Task <IActionResult> Index(int?categoryId) { if (categoryId.HasValue) { var blogs = await _blogApiService.GetAllWithCategoryIdAsync(categoryId); ViewBag.ActiveCategory = categoryId; return(View(blogs)); } else { var blogs = await _blogApiService.GetAllAsync(); return(View(blogs)); } }