/// <summary>
        ///
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task <PingResponseVm> Handle(CreatePingCommand request, CancellationToken cancellationToken)
        {
            Ping ping = _mapper.Map <CreatePingCommand, Ping>(request);

            await _repository.AddAsync(ping, cancellationToken).ConfigureAwait(false);

            PingResponseVm vm = _mapper.Map <Ping, PingResponseVm>(ping);

            return(vm);
        }
Пример #2
0
 public async Task AddAsync(Guid id, string vehicleId, DateTime recivedAt)
 {
     //var activityCategory = await _pingRepository.GetAsync(category);
     //if (activityCategory == null)
     //{
     //    throw new ActioException("category_not_found",
     //        $"Category: '{category}' was not found.");
     //}
     var pingInfo = new PingData(id, vehicleId, recivedAt);
     await _pingRepository.AddAsync(pingInfo);
 }