Beispiel #1
0
        public ActionResult InitialSetup()
        {
            TreasureContext db = new TreasureContext();

            Team team = new Team
            {
                CurrentPage = new Page{PageID=1},
                Name = "Team Win",
            };
            User rupesh = new User
            {
                Name = "Rupesh",
                PhoneNumber = "+447796616402",
                Team = team
            };
            User stu = new User
            {
                Name = "Rupesh",
                PhoneNumber = "+447796616402",
                Team = team
            };

            Page page1 = new Page();
            page1.Items.Add(new BasicSingleActionPageItem
            {
                ExpectedInput = "Hello",
                CorrectResponse = "Mary’s father has 5 daughters – Nana, Nene, Nini, Nono. What is the fifth daughters name?",
                IncorrectResponse = "Mary’s father has 5 daughters – Nana, Nene, Nini, Nono. What is the fifth daughters name?",
                ExpectedInputNumber = "+441506243065",
                NextPage = new Page{PageID = 2},
                Interaction = InteractionType.TextMessage,
            });
            Page page2 = new Page();
            page2.Items.Add(new BasicSingleActionPageItem
            {
                ExpectedInput = "Mary",
                CorrectResponse = "Hurrah!",
                IncorrectResponse = "No!",
                ExpectedInputNumber = "+441506243065",
                Interaction = InteractionType.TextMessage,
                NextPage = new Page{PageID = 2},
            });

            db.Teams.Add(team);
            db.Users.Add(rupesh);
            db.Users.Add(stu);

            db.Page.Add(page1);
            db.Page.Add(page2);

            db.SaveChanges();

            return Json("Done", JsonRequestBehavior.AllowGet);
        }
Beispiel #2
0
 public Team GetTeamForUser(User user)
 {
     return user.Team;
 }