private static void Seed() { Roles.CreateRole("User"); Roles.CreateRole("Administrator"); Roles.CreateRole("Teacher"); foreach (Int32 index in Enumerable.Range(1, 10)) { var name = "user" + index + "@olts.com"; WebSecurity.CreateUserAndAccount(name, name); if (index % 3 == 0) { Roles.AddUserToRole(name, "Administrator"); } else if (index % 2 == 0) { Roles.AddUserToRole(name, "Teacher"); } else { Roles.AddUserToRole(name, "User"); } } using (var context = new OltsContext()) { foreach (Int32 index in Enumerable.Range(1, 3)) { var survey = new Survey { Name = "Survey Name" + index, Description = "Survey Description" + index, Owner = context.Users.First(), Questions = new List<Question> { new Question { QuestionType = QuestionType.Checkbox, Text = "Question " + index, OfferedAnswers = new List<OfferedAnswer> { new OfferedAnswer { AnswerText = "1" }, new OfferedAnswer { AnswerText = "2" }, new OfferedAnswer { AnswerText = "3" } } }, new Question { QuestionType = QuestionType.Radio, Text = "Question " + index, OfferedAnswers = new List<OfferedAnswer> { new OfferedAnswer { AnswerText = "1" }, new OfferedAnswer { AnswerText = "2" }, new OfferedAnswer { AnswerText = "3" } } }, new Question { QuestionType = QuestionType.Textbox, Text = "Question " + index }, new Question { QuestionType = QuestionType.Textarea, Text = "Question " + index } } }; context.Surveys.Add(survey); } context.SaveChanges(); } }