예제 #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()));
 }
예제 #3
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));
            }
        }
예제 #4
0
 public async Task <IActionResult> Index()
 {
     ViewData["Active"] = "blog";
     return(View(await _blogApiService.GetAllAsync()));
 }
예제 #5
0
        public async Task <IActionResult> Index()
        {
            var blogs = await _blogApiService.GetAllAsync();

            return(View(blogs));
        }
예제 #6
0
 public async Task <IActionResult> Index()
 {
     return(View(await _blogApiService.GetAllAsync()));
 }