public GetReservationDto ReservationToGetReservationDto(Reservation reservation)
        {
            var status = AssignStatus(reservation.StartDate, reservation.EndDate);

            return(new GetReservationDto
            {
                Id = reservation.Id,
                Balance = reservation.Balance,
                StartDate = reservation.StartDate,
                EndDate = reservation.EndDate,
                Status = status,
                Paid = reservation.IsPaid,
                Room = _roomConverter.RoomToGetRoomDto(reservation.Room),
                Client = _clientConverter.ClientToGetClientDto(reservation.Client)
            });
        }
Ejemplo n.º 2
0
        public async Task <GetInvoiceDto> GetInvoiceData(int id)
        {
            var invoiceData = new GetInvoiceDto();

            var reservation = await _reservationRepository.GetAsync(id);

            reservation.Client = await _clientRepository.GetAsync(reservation.ClientId);

            reservation.Room = await _roomRepository.GetAsync(reservation.RoomId);

            var assignedMinuteServices = await _minuteServicesToReservationRepository.ListAssignedAsync(reservation.Id);

            var hotelCompany = await _hotelCompanyRepository.GetAsync();


            invoiceData.HotelCompanyDetails = _hotelCompanyConverter.HotelCompanyToGetHotelCompanyDto(hotelCompany);
            invoiceData.Positions.AddRange(assignedMinuteServices.Select(ms => _invoicePositionConverter.MinuteServiceToGetInvoicePositionDto(ms)));
            invoiceData.Positions.Add(_invoicePositionConverter.ReservationToGetInvoicePositionDto(reservation));
            invoiceData.ClientDetails = _clientConverter.ClientToGetClientDto(reservation.Client);
            invoiceData.IssueDate     = DateTime.Today;
            invoiceData.PaymentDate   = DateTime.Today;

            return(invoiceData);
        }
Ejemplo n.º 3
0
 public IEnumerable <GetClientDto> FilterClients(Dictionary <string, string> pairs, Dictionary <string, bool> company)
 {
     return(_clientRepository.Filter(pairs, company)
            .Select(c => _clientConverter.ClientToGetClientDto(c)));
 }
Ejemplo n.º 4
0
        public async Task <GetClientDto> GetClientAsync(int id)
        {
            var client = await _repository.GetAsync(id);

            return(_converter.ClientToGetClientDto(client));
        }