static public void CreateSubscription(RegisterNotificationsRequest request) { TravelerRepository travelersRepository = new TravelerRepository(); Traveler traveler = travelersRepository.FindBy(t => t.TravelerUserIdentity == request.DeviceID).SingleOrDefault(); if (traveler != null) { WNSManager.RegisterDevice(traveler.TravelerId, request.DeviceURI); } }
public HttpResponseMessage RegisterForNotifications ([FromBody] RegisterNotificationsRequest request) { var traveler = Travelers.FindBy(t => t.TravelerUserIdentity == request.DeviceID).SingleOrDefault(); // Handling the HTTP status codes if (traveler == null) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } else { WNSManager.RegisterDevice(request.DeviceID, request.DeviceURI); return(Request.CreateResponse(HttpStatusCode.Created, request)); } }