Пример #1
0
        public PagedResultsDto GetAllBackgrounds(int page, int pageSize, long userId)
        {
            var backgroundObj = _backgroundService.GetAllBackgrounds(page, pageSize, userId);

            if (backgroundObj == null)
            {
                throw new NotFoundException(ErrorCodes.BackgroundNotFound);
            }

            foreach (var background in (IEnumerable <BackgroundDto>)backgroundObj.Data)
            {
                var checkResturentBackground = _restaurantService.GetRestaurantByAdminId(userId).BackgroundId == background.BackgroundId;
                if (checkResturentBackground)
                {
                    background.IsActive = true;
                }
                else
                {
                    background.IsActive = false;
                }
            }
            var results = backgroundObj;

            return(results);
        }