Пример #1
0
        public void Set(string step, string answer)
        {
            switch (step)
            {
            case "survey":
                if (FirstSurvey)
                {
                    FirstSurvey = false;
                }
                else
                {
                    SurveyAnswers.Add(answer);
                }
                break;

            case "test":
                if (FirstQuestion)
                {
                    FirstQuestion = false;
                }
                else
                {
                    Mate.Listen(int.Parse(answer[0].ToString()) - 1);
                }
                break;
            }
        }
Пример #2
0
        public async void SetPoints(int answerId)
        {
            var Availableanswer = Survey.Questions.SelectMany(ans => ans.Answers).FirstOrDefault(_answer => _answer.AnswerId == answerId);
            var answer          = Answers.FirstOrDefault(p => p.AnswerId == answerId);

            if (Availableanswer != null && Availableanswer.AnswerType == AnswerType.Yes)
            {
                var _av = SurveyAnswers.FirstOrDefault(p => p.Answer == Availableanswer.UserAnswer);
                if (_av == null)
                {
                    var flight = await SetFlight();

                    var _surveyAnswer = new SurveyAnswer
                    {
                        Answer       = Availableanswer.UserAnswer,
                        Question     = Availableanswer.Question.SurveyQuestion,
                        FlightDetail = new FlightDetail
                        {
                            DepartureDate = flight.DepartureDate,
                            ArrivalDate   = flight.ArrivalDate,
                            FlightNumber  = flight.FlightNumber
                        }
                    };
                    SurveyAnswers.Add(_surveyAnswer);
                }
                else
                {
                    SurveyAnswers.Remove(_av);
                }
            }
            if (answer != null)
            {
                Answers.Remove(answer);
            }
            else
            {
                Answers.Add(Availableanswer);
            }
        }