Ejemplo n.º 1
0
        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));
            }
        }