示例#1
0
        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));
        }
示例#2
0
        public async Task <VehicleDutyDto> GetByIdAsync(VehicleDutyId id)
        {
            var vehicleDuty = await this._repo.GetByIdAsync(id);

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

            return(VehicleDutyMapper.toDTO(vehicleDuty));
        }
示例#3
0
        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);
        }