Exemple #1
0
        public async Task <DriverDto> AddAsync(DriverDto dto)
        {
            var driver = DriverMapper.toDomain(dto);

            await this._repo.AddAsync(driver);

            await this._unitOfWork.CommitAsync();

            return(DriverMapper.toDTO(driver));
        }
Exemple #2
0
        public async Task <DriverDto> GetByIdAsync(DriverId id)
        {
            var driver = await this._repo.GetByIdAsync(id);

            if (driver == null)
            {
                return(null);
            }

            return(DriverMapper.toDTO(driver));
        }
Exemple #3
0
        public async Task <List <DriverDto> > GetAllAsync()
        {
            var list = await this._repo.GetAllAsync();

            foreach (Driver d in list)
            {
                Console.WriteLine("hh:" + d.ToString());
            }
            List <DriverDto> listDto = list.ConvertAll <DriverDto>(driver => DriverMapper.toDTO(driver));

            return(listDto);
        }