I have a Model which represents Categories. When my program runs it pulls all the categories from a SQLite database and puts them in a sort of data grid.
Each category itself may have a parent but no parent is a parent of any other category (ie its not an infinite upwards tree). The max is 1 level.
If it has a parent I wish to return the information about its parent as well as itself. If it doesn’t have a category then it would be blank in the column.
Here is what my WinUi 3 program currently looks like. What i am trying to do is say where it says “Chicken | 1” I wish it instead to say “Chicken | Meat” because 1 is the Primary key for the Meat Category of which chicken is a sub category.
Model
public class IngredientCategory
{
public int Id { get; set; }
public string Name { get; set; }
public int Parent { get; set; }
public IngredientCategory(){}
public IngredientCategory(int id, string name, int parent)
{
Id = id;
Name = name;
Parent = parent;
}
}