private static void CreateQuestionsQuizAndGame(PlaySchoolContext context) { if (context.Games.Any()) { for (int i = 0; i < 20; i++) { Game game = new Game() { Description = PlaySchool.Models.Constants.SampleGameDescription, JsUrl = PlaySchool.Models.Constants.JsGameUrlBBreaker, Name = "BBreaker" + (i + 1) }; game.Creator = context.Users.FirstOrDefault(u => u.UserName == "root"); //ADD GAME context.Games.Add(game); Quiz quiz = new Quiz() { Creator = context.Users.FirstOrDefault(u => u.UserName == "root"), Game = game, }; //ADD QUIZZES context.Quizzes.Add(quiz); context.SaveChanges(); Question quest1 = new Question() { Answer = "4", QuestionTitle = "How many row of bricks BBreaker have?", QuestionTip = "Write the number you think is the answer!(ex: 4)", Quiz = quiz }; Question quest2 = new Question() { Answer = "Yes", QuestionTitle = "The game continue after you destroy all bricks?", QuestionTip = "Yes or No?(ex: Yes)", Quiz = quiz }; Question quest3 = new Question() { Answer = "5", QuestionTitle = "How many column of bricks BBreaker have?", QuestionTip = "Write the number you think is the answer!(ex. 5)", Quiz = quiz }; //ADD QUESTIONS context.Questions.AddRange(new List <Question>() { quest1, quest2, quest3 }); } } context.SaveChanges(); }
public AccountService(PlaySchoolContext context) : base(context) { }
protected Service(PlaySchoolContext context) { this.Context = context; }
public AdminHomeService(PlaySchoolContext context) : base(context) { }
public GameService(PlaySchoolContext context) : base(context) { }