public async Task <VehicleDutyDto> AddAsync(VehicleDutyDto dto) { var vehicleDuty = VehicleDutyMapper.toDomain(dto); await this._repo.AddAsync(vehicleDuty); await this._unitOfWork.CommitAsync(); return(VehicleDutyMapper.toDTO(vehicleDuty)); }
public async Task <VehicleDutyDto> GetByIdAsync(VehicleDutyId id) { var vehicleDuty = await this._repo.GetByIdAsync(id); if (vehicleDuty == null) { return(null); } return(VehicleDutyMapper.toDTO(vehicleDuty)); }
public async Task <List <VehicleDutyDto> > GetAllAsync() { var vehicleDutyList = await this._repo.GetAllAsync(); foreach (VehicleDuty vehicleDuty in vehicleDutyList) { Console.WriteLine("Vehicle Duty ->" + vehicleDuty.ToString()); } List <VehicleDutyDto> listDto = vehicleDutyList.ConvertAll <VehicleDutyDto>(vehicleDuty => VehicleDutyMapper.toDTO(vehicleDuty)); return(listDto); }