Пример #1
0
 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()));
 }
Пример #2
0
 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()));
 }