Beispiel #1
0
        public IList <MealOutputDTO> GetMeals()
        {
            var meals = sellerService.GetMeals();
            IList <MealOutputDTO> mealsDTO = new List <MealOutputDTO>();

            foreach (var m in meals)
            {
                IList <string> garnishiesNames = new List <string>();
                if (m.Garnishies != null)
                {
                    foreach (var g in m.Garnishies)
                    {
                        garnishiesNames.Add(g.Name);
                    }
                }
                MealOutputDTO meal = new MealOutputDTO
                {
                    Id             = m.Id,
                    Name           = m.Name,
                    GarnishiesName = garnishiesNames,
                    Price          = m.Price,
                    Description    = m.Description,
                    Days           = m.Days
                };
                mealsDTO.Add(meal);
            }
            return(mealsDTO);
        }