C# Convert hierarchical model to other model

50 Views Asked by At

I have a hierarchical data ApiGroup as shown with below properties. This get populated from Api, I want to map this model into UIGroup model with below properties. Please suggest a efficient approach to do the same?

  • ApiGroup: List<ApiItem> Items

  • ApiItem: string Text, List<ApiItem> SubItems

To be converted into model

  • UIGroup: List<UIItem> Items

  • UIItem: string Text, List<UIItem> SubItems

Note:- here first retrieving hierarchical Items from Api and then map them to UI model to show on screen.

0

There are 0 best solutions below