예제 #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);
        }