Example #1
0
        public async Task UpdateLastDestination(UpdateLastDestinationDto updateLastDestinationDto)
        {
            var tracker = _busTrackerRepository.Set.Single(bt => bt.BusId == updateLastDestinationDto.BusId);

            tracker.LastDestinationId = updateLastDestinationDto.LastDestinationId;
            tracker.CurrentLattitude  = updateLastDestinationDto.CurrentLocation.Lattitude;
            tracker.CurrentLongitude  = updateLastDestinationDto.CurrentLocation.Longitude;

            await _entityService.SaveAsync(CancellationToken.None);

            var trackResponse = await _trackService.GetTrack(tracker.BusId);

            tracker.CurrentRouteStatus = JsonConvert.SerializeObject(trackResponse.Places);

            await _entityService.SaveAsync(CancellationToken.None);

            await _broadCastService.BroadCast(updateLastDestinationDto.BusId);

            await _pushNotifyService.NotifyUsers(tracker);
        }
Example #2
0
        public async Task <OkResult> UpdateLastDestination(UpdateLastDestinationDto updateLastDestinationDto)
        {
            await _busTrackService.UpdateLastDestination(updateLastDestinationDto);

            return(Ok());
        }