예제 #1
0
        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);
            }
        }
예제 #2
0
        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));
            }
        }