Beispiel #1
0
        public void UpdateUser(UserUpdateInputDTO user)
        {
            IList <Withdrawal> withdrawals = sellerService.GetWithdrawalsBySellerId(user.Id);
            Menu menu = sellerService.GetMenuBySellerId(user.Id);

            this.userService.UpdateUser(new User
            {
                Id          = user.Id,
                Email       = user.Email,
                Name        = user.Name,
                Password    = user.Password,
                Rate        = user.Rate,
                Withdrawals = withdrawals,
                Menu        = menu
            });
        }
Beispiel #2
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);
        }