예제 #1
0
        public async Task <IActionResult> Index(int?categoryId, string s)
        {
            if (categoryId.HasValue)
            {
                ViewBag.ActiveCategory = categoryId;
                return(View(await _blogApiService.GetAllByCategoryId((int)categoryId)));
            }
            if (!string.IsNullOrWhiteSpace(s))
            {
                ViewBag.SearchString = s;
                return(View(await _blogApiService.SearchAsync(s)));
            }

            return(View(await _blogApiService.GetAllAsync()));
        }