Esempio n. 1
0
        public ResponseDto <RestaurantProfileDto> GetProfile(string token)
        {
            var tokenService = new TokenService();
            var restaurantBusinessHourDtoService = new RestaurantBusinessHourDtoService();

            // Retrieve account by username
            var userGateway = new UserGateway();

            // Call the gateway
            var userAccountResponseDto = userGateway.GetUserByUsername(tokenService.GetTokenUsername(token));

            // Retrieve restaurant profile from database
            var restaurantProfileGateway = new RestaurantProfileGateway();

            var restaurantProfileResponseDto = restaurantProfileGateway.GetRestaurantProfileById(userAccountResponseDto.Data.Id);

            // Call the RestaurantBusinessHourDtoService
            var convertedRestaurantBusinessHourDtos = restaurantBusinessHourDtoService.SetStringTimesFromDateTimes(restaurantProfileResponseDto.Data.BusinessHours);

            // Replace the BusinessHourDtos with the converted ones
            restaurantProfileResponseDto.Data.BusinessHours = convertedRestaurantBusinessHourDtos;

            return(restaurantProfileResponseDto);
        }