public async Task <TripDto> AddAsync(TripDto dto) { var trip = TripMapper.toDomain(dto); await this._repo.AddAsync(trip); await this._unitOfWork.CommitAsync(); return(TripMapper.toDTO(trip)); }
public async Task <TripDto> GetByIdAsync(TripId id) { var trip = await this._repo.GetByIdAsync(id); if (trip == null) { return(null); } return(TripMapper.toDTO(trip)); }
public async Task <List <TripDto> > GetAllAsync() { var tripsList = await this._repo.GetAllAsync(); foreach (Trip trip in tripsList) { Console.WriteLine("Trip ->" + trip.ToString()); } List <TripDto> listDto = tripsList.ConvertAll <TripDto>(trip => TripMapper.toDTO(trip)); return(listDto); }