Exemple #1
0
    public static List <MenuViewModel> ConvertToViewModel(this List <Menu> gs, int level = 0)
    {
        List <MenuViewModel> a = new List <MenuViewModel>();

        foreach (var i in gs)
        {
            a.Add(new MenuViewModel()
            {
                ID = i.ID, Title = Extenisons.Dashis(level) + i.Title, Menu = i
            });
            a.AddRange(ConvertToViewModel(i.Children, level + 1));
        }
        return(a);
    }
Exemple #2
0
    public static List <CategoryView> ConvertToViewModel(this List <Category> gs, int level = 0)
    {
        List <CategoryView> a = new List <CategoryView>();

        foreach (var i in gs)
        {
            a.Add(new CategoryView()
            {
                ID = i.ID, Title = Extenisons.Dashis(level) + i.Title, theCategory = i
            });
            a.AddRange(ConvertToViewModel(i.SubCategories, level + 1));
        }
        return(a);
    }
Exemple #3
0
    public static List <SelectableGroup> ConvertToViewModel(this List <Group> gs, int level = 0)
    {
        List <SelectableGroup> a = new List <SelectableGroup>();

        foreach (var i in gs)
        {
            a.Add(new SelectableGroup()
            {
                ID = i.ID, Selected = false, Text = Extenisons.Dashis(level) + i.Title, Group = i
            });
            a.AddRange(ConvertToViewModel(i.Children, level + 1));
        }
        return(a);
    }