Beispiel #1
0
        public async Task <IActionResult> GetLocationWithCertainTime(Guid vehicleId, DateTimeOffset from,
                                                                     DateTimeOffset to, CancellationToken cancellationToken)
        {
            var result = await _trackingQueryService.GetLocationHistoryAsync(VehicleId.With(vehicleId), cancellationToken);

            var peroid = result.OrderBy(x => x.TimeStamp).Where(x => x.TimeStamp >= from && x.TimeStamp <= to);

            return(Ok(peroid));
        }
Beispiel #2
0
        public async Task <IActionResult> GetVehicle(string id, CancellationToken cancellationToken)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(BadRequest(nameof(NullReferenceException)));
            }


            var result = await _vehicleQueryService.GetVehicleByIdAsync(VehicleId.With(Guid.Parse(id)), cancellationToken);

            return(new JsonResult(result));
        }
Beispiel #3
0
        public async Task <IActionResult> GetAllLocation(Guid vehicleId, CancellationToken cancellationToken)
        {
            var result = await _trackingQueryService.GetLocationHistoryAsync(VehicleId.With(vehicleId), cancellationToken);

            return(Ok(result));
        }
 public async Task StoreVehicleLocationAsync(Guid vehicleId, double latitude, double longitude, double zindex, CancellationToken ctx)
 {
     await _commandBus.PublishAsync(new UpdateVehicleLocationCommand(VehicleId.With(vehicleId),
                                                                     latitude, longitude, zindex), ctx);
 }
Beispiel #5
0
 public VehicleMapperProfile()
 {
     CreateMap <VehicleViewModel, VehicleEntity>()
     .ConstructUsing(x => new VehicleEntity(string.IsNullOrEmpty(x.Id) ? VehicleId.New : VehicleId.With(x.Id)));
 }
        public async Task <IActionResult> GetVehicle(Guid vehicleId, CancellationToken cancellationToken)
        {
            var result = await _trackingQueryService.GetCurrentVehicleLocationAsync(VehicleId.With(vehicleId), cancellationToken);

            return(new JsonResult(result));
        }