public IQueryable <AgentBoundedData <SlimAccommodationBookingInfo> > GetAgencyBookingsInfo(AgentContext agentContext) { return(from booking in _context.Bookings join agent in _context.Agents on booking.AgentId equals agent.Id where booking.AgencyId == agentContext.AgencyId && !BookingStatusesToHide.Contains(booking.Status) select new AgentBoundedData <SlimAccommodationBookingInfo> { Agent = new SlimAgentDescription { Id = agent.Id, FirstName = agent.FirstName, LastName = agent.LastName, Position = agent.Position }, Data = new SlimAccommodationBookingInfo { Id = booking.Id, ReferenceCode = booking.ReferenceCode, AccommodationName = booking.AccommodationName, CountryName = booking.Location.Country, LocalityName = booking.Location.Locality, Deadline = booking.DeadlineDate, Price = new MoneyAmount(booking.TotalPrice, booking.Currency), CheckInDate = booking.CheckInDate.DateTime, CheckOutDate = booking.CheckOutDate.DateTime, Status = booking.Status, PaymentStatus = booking.PaymentStatus, Rooms = booking.Rooms, Supplier = (int)booking.Supplier } }); }
/// <summary> /// Gets all booking info of the current agent /// </summary> /// <returns>List of the slim booking models </returns> public IQueryable <SlimAccommodationBookingInfo> GetAgentBookingsInfo(AgentContext agentContext) { var bookingData = _context.Bookings .Where(b => b.AgentId == agentContext.AgentId) .Where(b => !BookingStatusesToHide.Contains(b.Status)) .Select(b => new SlimAccommodationBookingInfo { Id = b.Id, ReferenceCode = b.ReferenceCode, AccommodationName = b.AccommodationName, CountryName = b.Location.Country, LocalityName = b.Location.Locality, Deadline = b.DeadlineDate, Price = new MoneyAmount(b.TotalPrice, b.Currency), CheckInDate = b.CheckInDate, CheckOutDate = b.CheckOutDate, Status = b.Status, PaymentStatus = b.PaymentStatus, Rooms = b.Rooms, Supplier = (int)b.Supplier, Created = b.Created } ); return(bookingData); }