Пример #1
0
        public async Task <DriverDutyDto> AddAsync(DriverDutyDto dto)
        {
            var driverDuty = DriverDutyMapper.toDomain(dto);

            await this._repo.AddAsync(driverDuty);

            await this._unitOfWork.CommitAsync();

            return(DriverDutyMapper.toDTO(driverDuty));
        }
Пример #2
0
        public async Task <DriverDutyDto> GetByIdAsync(DriverDutyId id)
        {
            var driverDuty = await this._repo.GetByIdAsync(id);

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

            return(DriverDutyMapper.toDTO(driverDuty));
        }
Пример #3
0
        public async Task <List <DriverDutyDto> > GetAllAsync()
        {
            var driverDutyList = await this._repo.GetAllAsync();

            foreach (DriverDuty driverDuty in driverDutyList)
            {
                Console.WriteLine("Driver Duty ->" + driverDuty.ToString());
            }
            List <DriverDutyDto> listDto = driverDutyList.ConvertAll <DriverDutyDto>(driverDuty => DriverDutyMapper.toDTO(driverDuty));

            return(listDto);
        }