public async Task <IActionResult> GetAdminDashboardDataAsync() { IList <ApplicationUser> adminUsersList = await _userManager.GetUsersInRoleAsync(UserType.Admin.ToString()); List <Booking> bookingList = await _bookingService.AllBookingDetailsAsync(); List <VenueDetail> venueList = await _venueService.GetVenueDetailsAsync(); var bookings = (from booking in bookingList join venue in venueList on booking.VenueID equals venue.VenueID group booking.VenueDetail by booking.VenueID into venueBookingGroup select new { venueBookingGroup.ElementAt(0).VenueName, venueBookingGroup.ElementAt(0).VenueCity, BookingCount = venueBookingGroup.Count() }).ToList(); return(Ok(new { AdminCount = adminUsersList.Count, BookingCount = bookingList.Count, VenueCount = venueList.Count, VenueBookingMapping = bookings })); }
public async Task <IActionResult> GetAllVenueDetailsAsync() { List <VenueDetail> venueDetails = await _venueService.GetVenueDetailsAsync(); List <VenueInventoryViewModel> venueInventoryList = venueDetails .Select(x => new VenueInventoryViewModel { VenueID = x.VenueID, VenueName = x.VenueName, AirConditioningType = x.InventoryDetails.AirConditioningType, VenueState = x.VenueState, VenueCity = x.VenueCity, Description = x.InventoryDetails.Description, IsCoffeeVendingMachineAvailable = x.InventoryDetails.IsCoffeeVendingMachineAvailable, IsWaterVendingMachineAvailable = x.InventoryDetails.IsWaterVendingMachineAvailable, WirelessNetworkType = x.InventoryDetails.WirelessNetworkType, HourlyRate = x.InventoryDetails.HourlyRate, IsActive = x.IsActive, IsFoodVendingMachineAvailable = x.InventoryDetails.IsFoodVendingMachineAvailable, NumberOfMicroPhones = x.InventoryDetails.NumberOfMicroPhones, NumberOfPhones = x.InventoryDetails.NumberOfPhones, NumberOfProjectors = x.InventoryDetails.NumberOfProjectors, RoomType = x.InventoryDetails.RoomType, SeatCapacity = x.InventoryDetails.SeatCapacity, VenueImages = x.VenueImages }).ToList(); return(Ok(venueInventoryList)); }