示例#1
0
        public async Task <IActionResult> Index(string data = "all")
        {
            var cat = new PostAndCategoryDto()
            {
                Categories = await _homeServices.GetCategories(),
                Posts      = await _homeServices.FilterByCategory(data)
            };

            ViewData["Genre"] = "all";
            if (data != "all" && data != null)
            {
                ViewData["Genre"] = data;
                return(View(cat));
            }
            return(View(cat));
        }