Esempio n. 1
0
 /// <summary>
 /// Se agrega un nuevo Viajero al Camino. Se acepta hasta 6 Viajeros.
 /// </summary>
 /// <param name="traveler"> Viajero a agregar</param>
 public void AddTravelers(Traveler traveler)
 {
     if (travelers.Count < 6)
     {
         Travelers.Add(traveler);
     }
 }
        //[HttpPost]
        //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);
        //    }
        //}

        public HttpResponseMessage Post([FromBody] Traveler traveler)
        {
            // saving the new order to the database
            Travelers.Add(traveler);
            Travelers.Save();

            AddInitialData(traveler);

            // creating the response, with three key features:
            // 1. the newly saved entity
            // 2. 201 Created status code
            // 3. Location header with the location of the new resource
            var response = Request.CreateResponse(HttpStatusCode.Created, traveler);

            response.Headers.Location = new Uri(Request.RequestUri, traveler.TravelerId.ToString());
            return(response);
        }
Esempio n. 3
0
 public virtual bool Book(String p)
 {
     Travelers.Add(p);
     return(true);
 }