示例#1
0
        /*public static void InitializeUsersRolesDb(UsersRolesDB context)
         * {
         *  context.Database.EnsureCreated();
         *
         *  if (!context.UserRoles.Any())
         *  {
         *      SeedUsersRolesDB.GenerateSeed(context);
         *  }
         *
         *  context.SaveChanges();
         * }*/

        public static void InitializeStudentApplications(Student_final_Context context)
        {
            context.Database.EnsureCreated();

            if (!context.Students.Any())
            {
                SeedStudents.GenerateSeed(context);
            }

            context.SaveChanges();
        }
示例#2
0
        public static void GenerateSeed(Student_final_Context context)
        {
            context.Students.Add(new Student
            {
                Uid                     = "u1234567",
                FirstName               = "User",
                LastName                = "First",
                EmailAddress            = "*****@*****.**",
                PhoneNumber             = "3341234567",
                DegreePlan              = "BS",
                GPA                     = 3,
                HoursPerWeek            = 20,
                personalStatement       = "YES",
                ExpectedGraduationDate  = DateTime.Parse("2020-12-29"),
                ApplicationDate         = DateTime.Now,
                Active                  = false,
                StudentSkills           = "Coding",
                StudentCompletedCourses = "Course1, Course2, Course3",
                StudentInterests        = "Music, Eating",
                Resume                  = "Resume 1"
            });

            context.Students.Add(new Student
            {
                Uid                     = "u1234568",
                FirstName               = "User",
                LastName                = "Second",
                EmailAddress            = "*****@*****.**",
                PhoneNumber             = "3341234567",
                DegreePlan              = "BS",
                GPA                     = 3.5,
                HoursPerWeek            = 20,
                personalStatement       = "YES",
                ExpectedGraduationDate  = DateTime.Parse("2020-12-29"),
                ApplicationDate         = DateTime.Now,
                Active                  = false,
                StudentSkills           = "Writing",
                StudentCompletedCourses = "Course1, Course2, Course3",
                StudentInterests        = "Music, Eating",
                Resume                  = "Resume 2"
            });

            context.SaveChanges();
        }
示例#3
0
 public StudentsController(Student_final_Context context)
 {
     _context = context;
 }