// GET: Tracking public ActionResult Index(Guid id) { var ViewModel = new TrackingModel(); Letter letter = _azureBlobService.GetFromBlobStore(id); foreach (var messageEvent in letter.Events) { var trackingStatus = TrackingServiceBuilder.GetTrackingStatus(messageEvent); ViewModel.TrackingStatuses.Add(trackingStatus); } ViewModel.LetterId = id; return(View(ViewModel)); }
public HttpStatusCode Post(Guid id) { var scheduledDateTimeUtc = DateTime.UtcNow; var letter = _azureBlobService.GetFromBlobStore(id); var newEvent = new Event() { EventName = "ArrivedAtNationalSortingHub", ScheduledDateTimeUtc = scheduledDateTimeUtc }; letter.Events.Add(newEvent); _azureBlobService.UploadToAzureBlobStore(letter); var eventModelToPush = TrackingServiceBuilder.GetTrackingStatus(newEvent); var pusher = new Pusher("94194", "09e07fa6d1e3db728a17", "a1f339dc466359b5915b"); var result = pusher.Trigger(id.ToString(), "Arrived_At_National_Sorting_Hub_Event", new { FriendlyTrackingName = eventModelToPush.FriendlyTrackingName, FriendlyTrackingDescription = eventModelToPush.FriendlyTrackingDescription, FriendlyEventTime = eventModelToPush.FriendlyEventTime }); return(HttpStatusCode.OK); }
// POST: api/Dispatch/5 public HttpStatusCode Post(Guid id) { var scheduledDateTimeUtc = DateTime.UtcNow; var letter = _azureBlobService.GetFromBlobStore(id); var newEvent = new Event() { EventName = "SmsDispatchedEvent", ScheduledDateTimeUtc = scheduledDateTimeUtc }; letter.Events.Add(newEvent); _azureBlobService.UploadToAzureBlobStore(letter); var eventModelToPush = TrackingServiceBuilder.GetTrackingStatus(newEvent); var pusher = new Pusher("94194", "09e07fa6d1e3db728a17", "a1f339dc466359b5915b"); var result = pusher.Trigger(new[] { letter.Address, id.ToString() }, "sms_dispatched_event_v2", new { FriendlyTrackingName = eventModelToPush.FriendlyTrackingName, FriendlyTrackingDescription = eventModelToPush.FriendlyTrackingDescription, FriendlyEventTime = eventModelToPush.FriendlyEventTime }); _messageEventService.EnqueueMessage(letter); return(HttpStatusCode.OK); }