示例#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()));
 }
 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));
            }
        }
示例#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()));
 }