Example #1
0
        public void LoadAll()
        {
            Dishes  = _dishRepository.LoadDishes();
            Sources = _sourceRepository.LoadSources();
            Tags    = _tagRepository.LoadTags();
            var dishTags = _dishRepository.LoadDishTags();

            SortDishes();
            SortSources();
            SortTags();
            foreach (var dish in Dishes)
            {
                dish.Source = Sources.First(s => s.Id == dish.SourceId);
                dish.Tags   = dishTags
                              .Where(dt => dt.DishId == dish.Id)
                              .Select(dt => Tags.First(t => t.Id == dt.TagId))
                              .ToList();
            }
        }