private async void SaveCandidate_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(CandidateName.Text) || !string.IsNullOrWhiteSpace(PositionCombo.Text) || !string.IsNullOrWhiteSpace(RankCombo.Text) || !string.IsNullOrWhiteSpace(RankCombo.Text) || CandidateImage != null ) { var candidate = new Candidate { Id = _candidateId, CandidateName = CandidateName.Text, CandidatePicture = Util.ConvertToBytes(CandidateImage), PositionId = (int)PositionCombo.SelectedValue, RankId = (int)RankCombo.SelectedValue }; await ElectionConfigurationService.SaveCandidate(candidate); Util.Clear(this); CandidateImage.Source = new BitmapImage(new Uri("../Resources/images/people_on_the_beach_300x300.jpg", UriKind.Relative)); PositionCombo.ItemsSource = await ElectionConfigurationService.GetAllPositionsAsync(); RefreshCandidateList(); } }