Ejemplo n.º 1
0
        private async void AddTripButton_Click(object sender, RoutedEventArgs e)
        {
            NewTripNameTextBox.Text     = "";
            NewTripStartDatePicker.Date = DateTimeOffset.Now;
            NewTripEndDatePicker.Date   = DateTimeOffset.Now.AddDays(7);

            ContentDialogResult result = await AddTripDialog.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                TripDTO newTrip = new TripDTO
                {
                    Name          = NewTripNameTextBox.Text,
                    StartDateTime = NewTripStartDatePicker.Date.DateTime,
                    EndDateTime   = NewTripEndDatePicker.Date.DateTime
                };

                var trips = await _service.AddTrip(newTrip);

                SetupTrips(trips);
                Bindings.Update();
            }
        }