Exemplo n.º 1
0
        public IQueryable <Event> Get(EventType?type, bool includeAll = true)
        {
            switch (type)
            {
            case EventType.Concert:
            {
                return(ConcertRepository.Get(null, includeProperties: includeAll?_concertsIncludes: string.Empty));
            }

            case EventType.Exhibition:
            {
                return(ExhibitionRepository.Get(null, includeProperties: includeAll?_exhibitionsIncludes: string.Empty));
            }

            case EventType.Movie:
            {
                return(MovieRepository.Get(null, includeProperties: includeAll?_moviesIncludes: string.Empty));
            }

            case EventType.Performance:
            {
                return(PerformanceRepository.Get(null, includeProperties: includeAll?_performancesIncludes: string.Empty));
            }

            case EventType.Sport:
            {
                return(SportRepository.Get(null, includeProperties: includeAll?_sportIncludes: string.Empty));
            }

            default: return(GetAll(includeAll));
            }
        }
Exemplo n.º 2
0
        public IQueryable <Event> GetAll(bool includeAll = true)
        {
            //temporary solution caused by ef bug
            IEnumerable <Event> events = new List <Event>();

            events = events.Concat(ConcertRepository
                                   .Get(null, includeProperties: includeAll ? _concertsIncludes : string.Empty)
                                   .ToList())
                     .Concat(MovieRepository
                             .Get(null, includeProperties: includeAll ? _moviesIncludes : string.Empty)
                             .ToList())
                     .Concat(SportRepository
                             .Get(null, includeProperties: includeAll ? _sportIncludes : string.Empty)
                             .ToList())
                     .Concat(PerformanceRepository
                             .Get(null, includeProperties: includeAll ? _performancesIncludes : string.Empty)
                             .ToList())
                     .Concat(ExhibitionRepository
                             .Get(null, includeProperties: includeAll ? _exhibitionsIncludes : string.Empty)
                             .ToList());
            return(events.AsQueryable());
        }