Got a table with column names as such
Name | ProductID | Price | Category | SubCategory
I am passing a category name into an action method and I want to return the subcategory names that are on the same row as the category name that is passed in.
So something like this, except this is wrong:
var subcategories =
productsRepository.Products
.Select(x => x.SubCategory.Where(x.Category == category);
So I can then collect the distinct subcategory names with this:
foreach (string subcategoryName in subcategories.Distinct().OrderBy(x => x))
Thanks.
Are you looking for:
On another note, it does appear that your database isn’t normalized.