User-973886032 posted
hi guys
I added [Route("{Category"}] attribute to my Home Controller, so I can have products like this
www.xyz.com/TShirts
www.xyz.com/mugs
which works fine, and other controllers too work fine, but I noticed that my users controller is hijacked, as I put a breakpoint and noticed
www.xyz.com/Users
goes to the breakpoint on the home page. here is my code
[Route("/{C}")]
public async Task<IActionResult> Product(String C)
{
return View(await _context.Departments_SubCategory.Include(c => c.Departments_Category)
.Where(d => d.Departments_Category.Category_Name.Contains(C))
.Where(r => r.IsEnabled == true).Select(u => new Departments_SubCategory
{
CategoryID = u.CategoryID,
SubCategory_Name = u.SubCategory_Name,
EntryDate = u.EntryDate,
Description_Detailed = u.Description_Detailed,
Description_Short = u.Description_Short,
ProductCount = u.Products.Count()
}).ToListAsync());
And the users controller has no code as of yet, as I cant seem to get it hit. But when I removed the route attribute on the HOme controller, it works
public async Task<IActionResult> Index()
{
return View()
}