Type Class:
public partial class URS_Types
{
[Key]
public int ID { get; set; }
public string TypeName { get; set; }
public int? ParentID { get; set; }
}
I am trying to make a submethod that will receive the ID of "type" of request, it will then get it's parent (using the parentID), then that will get it's parents, until there isn't other category.
I have tried the below, but obviously this only returns the first type due to the select command, however not sure how to tell it to select all the types.
var types = GetURS_Types();
var test = from type in types
where type.ID == id
join type2 in types
on type.ParentID equals type2.ID
join type3 in types
on type2.ParentID equals type3.ID
select type.TypeName;