Exemplo n.º 1
0
        public MenuOutputDTO GetMenuBySellerId(int id)
        {
            var menu = sellerService.GetMenuBySellerId(id);

            menu.Seller = userService.GetUserById(menu.SellerId);
            menu.Meals  = sellerService.GetMealsByMenuId(menu.Id);
            IList <string> mealsNames = new List <string>();

            foreach (var meal in menu.Meals)
            {
                mealsNames.Add(meal.Name);
            }
            MenuOutputDTO menuOutput = new MenuOutputDTO
            {
                LimitOfMeals       = menu.LimitOfMeals,
                InitialTimeToOrder = menu.InitialHour.ToShortTimeString(),
                FinalTimeToOrder   = menu.FinalHour.ToShortTimeString(),
                MealsNames         = mealsNames,
                SellerName         = menu.Seller.Name
            };

            return(menuOutput);
        }