public async Task SaveTripAsync() { try { string currentuser = (string)ApplicationData.Current.LocalSettings.Values["current_user_email"]; var person = await AccountController.GetPersonByEmail(currentuser); Trip.Travelers.Add(person); HttpResponseMessage respone = await TripController.CreateTrip(Trip); if (respone.IsSuccessStatusCode) { var list = await TripController.GetAllSimpleAsync(); var insertedTrip = list.FirstOrDefault(i => i.Start.Equals(Trip.Start) && i.End.Equals(Trip.End) && i.Name.Equals(Trip.Name) || i.Color.Equals(Trip.Color)); Trip.TripId = insertedTrip.TripId; SendSuccesfull = true; } else { InfoBarSeverity = InfoBarSeverity.Warning; IsOpen = true; ErrorMessage = "Er is iets fout gelopen bij het opslaan van de trip"; SendSuccesfull = false; } } catch (Exception) { InfoBarSeverity = InfoBarSeverity.Warning; IsOpen = true; ErrorMessage = "Er is iets fout gelopen bij het opslaan van de trip"; SendSuccesfull = false; } }
private static async Task CreateTrip() { TripController CurrentTrip = new TripController(); await CurrentTrip.CreateTrip(dBConnectionInfo); }