Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var client = new FoodleServiceClient();

            var result = client.GetVoteOptions();

            var vote = new Vote
                {
                    Prio1 = result.Restaurants[0],
                    Prio2 = result.Restaurants[1],
                    Prio3 = result.Restaurants[2]
                };

            var submitted = client.SubmitVote(vote);

            var res = client.GetResults();

            Console.WriteLine();
        }
Example #2
0
        private void SendVoteButton_Click(object sender, RoutedEventArgs e)
        {
            if (_voteOptions == null)
                MessageBox.Show("Please get options first");
            else if (ValidVotes.Count() != 3)
                MessageBox.Show("Select three items");
            else
            {
                var client = new FoodleServiceClient();
                var request = new SaveVoteRequest
                    {
                        Vote = new Vote
                            {
                                Prio1 = ValidVotes.ElementAt(0),
                                Prio2 = ValidVotes.ElementAt(1),
                                Prio3 = ValidVotes.ElementAt(2)
                            }
                    };

                var resp = client.SubmitVote(request);
                GetResults(string.Format("Your vote has been {0}.", resp.Status));
            }
        }