public List <EventDto> GetEvents() { var events = _eventRepository.getAllEvents(); var venue = _venueRepository.getAllVenues(); var data2 = (from ev in events join ven in venue on ev.venue_id equals ven.venue_id select new { ev.event_id, ev.event_name, ev.event_date, ev.event_time, ev.venue_id, ev.available_seats, ev.artist_name, ev.description, ev.approval_status, ev.image, ven.venue_name, ven.total_seats, ev.ticketprice }).ToList(); var data = data2.OrderByDescending(s => s.event_date); return(data.Select(a => new EventDto { event_id = a.event_id, event_name = a.event_name, event_date = a.event_date, event_time = a.event_time, venue_id = a.venue_id, available_seats = a.available_seats, artist_name = a.artist_name, description = a.description, approval_status = a.approval_status, image = a.image, venue_name = a.venue_name, ticket_rate = a.ticketprice, total_seats = a.total_seats }).ToList()); }
public List <Venue> getAvailable(DateTime date) { var venue = _iVenueRepo.getAllVenues(); var activity = _iEventRepo.getAllEvents().Where(x => x.event_date.Date == date.Date); var data = (from ve in venue join act in activity on ve.venue_id equals act.venue_id select new { ve.venue_id, ve.venue_name, ve.total_seats, ve.ticket_rate }).ToList(); var venuefinal = (from p in venue where !data.Any(u => u.venue_id == p.venue_id) select p).ToList(); return(venuefinal); }