I have a list of Product (IList<Product>), with all data pre-populated.
Model: Product
public class Product
{
public int Id { get; set; }
public int ParentProductId { get; set; }
public string Code { get; set; }
public string Name { get; set; }
public IList<Product> Children { get; set; }
}
Property Children will be of type IList<Product>, means it is nested, it can again contain children up to n levels.
I have another model FilterModel.
Model: FilterModel
public class FilterModel
{
//// This is same as that of Product Code
public string Code { get; set; }
//// This is a combination of Products Name, Id and some static strings
public string FilterUrl { get; set; }
public IList<FilterModel> Children
}
Which also has a same nested structure.
I planning to insert data into my second model (FilterModel) from the first (Product). Is this possible in a recursive way?