Exemple #1
0
        public async Task <List <VenueInfo> > ListVenues()
        {
            var result = await repository.Venue
                         .Where(venue => !venue.Removed.Any())
                         .Select(venue => new
            {
                venue.VenueGuid,
                Description = venue.Descriptions
                              .OrderByDescending(d => d.ModifiedDate)
                              .FirstOrDefault()
            })
                         .ToListAsync();

            return(result
                   .Select(row => VenueInfo.FromEntities(row.VenueGuid, row.Description))
                   .ToList());
        }
Exemple #2
0
        public async Task <VenueInfo> GetVenue(Guid venueGuid)
        {
            var result = await repository.Venue
                         .Where(venue => venue.VenueGuid == venueGuid &&
                                !venue.Removed.Any())
                         .Select(venue => new
            {
                venue.VenueGuid,
                Description = venue.Descriptions
                              .OrderByDescending(d => d.ModifiedDate)
                              .FirstOrDefault(),
                Location = venue.Locations
                           .OrderByDescending(d => d.ModifiedDate)
                           .FirstOrDefault(),
                TimeZone = venue.TimeZones
                           .OrderByDescending(d => d.ModifiedDate)
                           .FirstOrDefault()
            })
                         .SingleOrDefaultAsync();

            return(result == null ? null : VenueInfo.FromEntities(
                       result.VenueGuid, result.Description, result.Location, result.TimeZone));
        }