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)); }
public async Task <DriverDutyDto> GetByIdAsync(DriverDutyId id) { var driverDuty = await this._repo.GetByIdAsync(id); if (driverDuty == null) { return(null); } return(DriverDutyMapper.toDTO(driverDuty)); }
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); }