Exemplo n.º 1
0
        private void VenueLayoutTreeInit()
        {
            VenueLayoutTreeSource = new ObservableCollection <TreeViewItemModel>();

            var allVenues = _venueService.GetAll();

            if (allVenues.Any())
            {
                var allLayouts = _layoutService.GetAll();

                foreach (var v in allVenues)
                {
                    var r = from x in allLayouts where v.Id == x.VenueId select x;
                    if (r.Any())
                    {
                        VenueLayoutTreeSource.Add(new TreeViewItemModel(VenueModel.FromEntity(v),
                                                                        LayoutModel.FromEntityList(r.ToList())));
                    }
                    else
                    {
                        VenueLayoutTreeSource.Add(new TreeViewItemModel(VenueModel.FromEntity(v)));
                    }
                }
            }
        }