public async Task <IActionResult> Index(int?categoryId) { if (categoryId.HasValue) { ViewBag.ActiveCategory = categoryId; return(View(await _blogApiService.GetAllByCategoryIdAsync((int)categoryId))); } return(View(await _blogApiService.GetAllAsync())); }
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.SearchString = s; return(View(await _blogApiService.SearchAsync(s))); } return(View(await _blogApiService.GetAllAsync())); }
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)); } }
public async Task <IActionResult> Index() { ViewData["Active"] = "blog"; return(View(await _blogApiService.GetAllAsync())); }
public async Task <IActionResult> Index() { var blogs = await _blogApiService.GetAllAsync(); return(View(blogs)); }
public async Task <IActionResult> Index() { return(View(await _blogApiService.GetAllAsync())); }