public void StoreAnswerId(string questionId, string answer) { if (answer != null) { var question = _questionManager.GetQuestion(questionId); if (question != null) { var validAnswers = answer.Split(new [] { ',' }, StringSplitOptions.RemoveEmptyEntries).Where(a => question.AnswerList.Any(x => x.Id == a)).ToArray(); var cookie = _cookieContext.GetCookie(Constants.CookieName.Answers) ?? new HttpCookie(Constants.CookieName.Answers); cookie[questionId] = validAnswers.Any() ? string.Join(",", validAnswers) : null; _cookieContext.SetCookie(cookie); } } }
private void CyclePlayers() { var penguins = allObjects.Where(t => t.GetType() == typeof(SmartPenguin)).Select(p => p as SmartPenguin).ToList(); for (int player = 1; player <= this.PlayersCount; player++) { IQuestion q = questionManager.GetQuestion(); questionManager.PrintQuestion(q); string input = Console.ReadLine(); if (q.InputForRightAnswer == input) { penguins[player - 1].Update(); } else { UpdateRelatedEnemies(penguins[player - 1]); } } }
public virtual ActionResult Index(string id) { if (id == null) { throw new ArgumentNullException(nameof(id)); } var question = _questionManager.GetQuestion(id); if (question == null) { throw new ArgumentException(nameof(id)); } if (question.QuestionNumber > _answerManager.GetAnswers().Count + 1) { return(RedirectToAction(MVC.Home.Index())); } question.Answer = _answerManager.RetrieveAnswerId(question.Id); return(View(question)); }
public QuestionDto GetQuestion(int Id) { var question = _questionManager.GetQuestion(Id); return(question); }
public async Task <QuestionDto> GetQuestion([FromRoute] string id) { return(await _QuestionManager.GetQuestion(id)); }
// GET api/<controller>/5 public async Task <API.Models.Question> Get(int id) { var question = await _questionManager.GetQuestion(id).ConfigureAwait(false); return(_questionMapper.ToAnyEntity(question)); }
public async Task <ActionResult <QuestionBinding> > GetQuestion(int UserClientID, int UserID, int DictionaryID, int QuestionTypeID) { var value = _manager.GetQuestion(UserID, UserClientID, DictionaryID, QuestionTypeID); return(await value); }