public void AskQuestion(int gameId, int playerId, string questionText) { var question = new Question { QuestionText = questionText, Status = QuestionStatus.UnAnswered }; var game = _context.Games.Single(g => g.Id == gameId); game.Questions.Add(question); _context.SaveChanges(); _notificationService.QuestionAsked(question.Id); }
/// <summary> /// Deprecated Method for adding a new object to the Questions EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToQuestions(Question question) { base.AddObject("Questions", question); }
/// <summary> /// Create a new Question object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="gameID">Initial value of the GameID property.</param> /// <param name="createdOn">Initial value of the CreatedOn property.</param> /// <param name="updatedOn">Initial value of the UpdatedOn property.</param> public static Question CreateQuestion(global::System.Int32 id, global::System.Int32 gameID, global::System.DateTime createdOn, global::System.DateTime updatedOn) { Question question = new Question(); question.Id = id; question.GameID = gameID; question.CreatedOn = createdOn; question.UpdatedOn = updatedOn; return question; }