private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            string name = AutoCompleteTravel.Text;
            Travel travel = new Travel(name, date);
            Console.WriteLine(travel.Name);

            travelsViewModel.AddTravel(travel);

            NavigationService.GoBack();
        }
        public void AddData(Travel travel)
        {
            WebClient webclient = new WebClient();
            //Please replace your webservice url here
            Uri uristring = new Uri("http://localhost:51037/api/journey");
            webclient.Headers["ContentType"] = "application/json";

            MemoryStream stream1 = new MemoryStream();
            DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(Travel));
            ser.WriteObject(stream1, travel);
            stream1.Position = 0;
            StreamReader sr = new StreamReader(stream1);

            string JsonStringParams = sr.ReadToEnd();
            webclient.UploadStringCompleted += wc_UploadStringCompleted;
            //Post data like this
            webclient.UploadStringAsync(uristring, "POST", JsonStringParams);
        }
 public void AddTravel(Travel travel)
 {
     TravelsCollection.Add(travel);
     //AddData(travel);
 }