private void Salvar(object sender, RoutedEventArgs e) { try { Client selectedClient = (Client)ClientName.SelectedValue; ComboBoxItem selectedType = (ComboBoxItem)Type.SelectedValue; ComboBoxItem selectedCardBrand = (ComboBoxItem)CardBrand.SelectedValue; string type = (string)selectedType.Content; string cardBrand = (string)selectedCardBrand.Content; CardValidation.Validation(CardholderName.Text, Number.Text, ExpirationDate.Text, cardBrand, type, selectedClient.IdClient); Card card = new Card() { CardholderName = CardholderName.Text, CardNumber = Number.Text, ExpirationDate = (DateTime)ExpirationDate.SelectedDate, CardBrand = cardBrand, Password = Password.Password, Type = type, IdClient = selectedClient.IdClient, Status = 1 }; string status = OldButGoldService.PostRequestCard(card); MessageBox.Show(status); this.NavigationService.Navigate(new Uri("Pages/Index.xaml", UriKind.Relative)); } catch (Exception ex) { MessageBox.Show(ex.Message); } }