예제 #1
0
        public async Task <List <VehicleDto> > GetAllAsync()
        {
            var list = await this._repo.GetAllAsync();

            List <VehicleDto> listDto = list.ConvertAll <VehicleDto>(vehicle => VehicleMapper.toDTO(vehicle));

            return(listDto);
        }
예제 #2
0
        public async Task <VehicleDto> AddAsync(VehicleDto dto)
        {
            var vehicle = VehicleMapper.toDomain(dto);

            await this._repo.AddAsync(vehicle);

            await this._unitOfWork.CommitAsync();

            return(VehicleMapper.toDTO(vehicle));
        }
예제 #3
0
        public async Task <VehicleDto> GetByIdAsync(VehicleId id)
        {
            var vehicle = await this._repo.GetByIdAsync(id);

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

            return(VehicleMapper.toDTO(vehicle));
        }