public static void Initialize(IServiceProvider serviceProvider) { using (var context = new BuffteksWebsiteContext(serviceProvider.GetRequiredService <DbContextOptions <BuffteksWebsiteContext> >())) { //replaced old SeedData with this one from ahuimanu github for elegance and simplicity // CLIENTS if (context.Clients.Any()) { //leave, there is already data in the database return; } var clients = new List <Client> { new Client { FirstName = "Jimmie", LastName = "Ramos", CompanyName = "ACME", Email = "*****@*****.**", Phone = "555-555-5555" }, new Client { FirstName = "Kristy", LastName = "Miles", CompanyName = "World Wide Industries", Email = "*****@*****.**", Phone = "555-555-5555" }, new Client { FirstName = "Shelley", LastName = "Walker", CompanyName = "Big Money Inc", Email = "*****@*****.**", Phone = "555-555-5555" } }; context.AddRange(clients); context.SaveChanges(); // CLIENTS if (context.Members.Any()) { //leave, there is already data in the database return; } var members = new List <Member> { new Member { FirstName = "Mamie", LastName = "Santiago", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555", Standing = "Junior" }, new Member { FirstName = "Pete", LastName = "Perez", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555", Standing = "Junior" }, new Member { FirstName = "Flora", LastName = "Williamson", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555", Standing = "Junior" }, new Member { FirstName = "Laverne", LastName = "Wolfe", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555", Standing = "Senior" }, new Member { FirstName = "Delia", LastName = "Bridges", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555", Standing = "Senior" }, new Member { FirstName = "Rebecca", LastName = "Morton", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555", Standing = "Junior" }, new Member { FirstName = "Bream", LastName = "McGregger", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555", Standing = "Junior" }, new Member { FirstName = "Franklin", LastName = "Arnold", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555", Standing = "Senior" }, new Member { FirstName = "Jeff", LastName = "Jackson", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555", Standing = "Junior" }, new Member { FirstName = "Tim", LastName = "Johnson", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555", Standing = "Junior" }, }; context.AddRange(members); context.SaveChanges(); // PROJECTS if (context.Projects.Any()) { //leave, there is already data in the database return; } var projects = new List <Project> { new Project { ProjectName = "The Big One", Details = "The One Project to rule them all" }, new Project { ProjectName = "Awesome", Details = "This project is awesome" }, new Project { ProjectName = "Easy Project", Details = "This project is so easy, it completes itself" } }; context.AddRange(projects); context.SaveChanges(); //PROJECT ROSTER BRIDGE TABLE - THERE MUST BE PROJECTS AND PARTICIPANTS MADE FIRST if (context.ProjectRoster.Any()) { //leave, there is already data in the database return; } //quickly grab the recent records added to the DB to get the IDs var projectsFromDb = context.Projects.ToList(); var clientsFromDb = context.Clients.ToList(); var membersFromDb = context.Members.ToList(); var projectroster = new List <ProjectRoster> { //take the first project from above, the first client from above, and the first three students from above. new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = clientsFromDb.ElementAt(0).ID.ToString(), ProjectParticipant = clientsFromDb.ElementAt(0) }, new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = membersFromDb.ElementAt(0).ID.ToString(), ProjectParticipant = membersFromDb.ElementAt(0) }, new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = membersFromDb.ElementAt(1).ID.ToString(), ProjectParticipant = membersFromDb.ElementAt(1) }, new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = membersFromDb.ElementAt(2).ID.ToString(), ProjectParticipant = membersFromDb.ElementAt(2) }, }; context.AddRange(projectroster); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new BuffteksWebsiteContext( serviceProvider.GetRequiredService <DbContextOptions <BuffteksWebsiteContext> >())) { // Look for any movies. if (context.Member.Any()) { return; // DB has been seeded } context.Member.AddRange( new Member { MemberID = 1, FirstName = "Trevor", LastName = "Vieth", Standing = "Junior", Major = "BA-CIS", Birthday = "12/21/1996", Email = "*****@*****.**", Phone = "806-681-5067", }, new Member { MemberID = 1, FirstName = "John", LastName = "Kieth", Standing = "Junior", Major = "CIS", Birthday = "12/21/1996", Email = "*****@*****.**", Phone = "806-681-5067", } ); context.Client.AddRange( new Client { ClientID = 1, FirstName = "Bob", LastName = "Jones", Email = "*****@*****.**", Phone = "806-555-6184" } ); context.Project.AddRange( new Project { ProjectID = 1, ClientsAssigned = "Bob Jones", MembersAssigned = "Trevor Vieth", Description = "Make blabla", DueDate = "4/21/2018", } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new BuffteksWebsiteContext(serviceProvider.GetRequiredService <DbContextOptions <BuffteksWebsiteContext> >())) { // CLIENTS if (context.Clients.Any()) { //leave, there is already data in the database return; } var clients = new List <Client> { new Client { FirstName = "James", LastName = "Mackleroy", CompanyName = "Apple", Email = "*****@*****.**", Phone = "806-443-9485" }, new Client { FirstName = "Kirstie", LastName = "Wool", CompanyName = "Google", Email = "*****@*****.**", Phone = "806-345-2945" }, new Client { FirstName = "Trevor", LastName = "Micheals", CompanyName = "Amarillo Bolt Company", Email = "*****@*****.**", Phone = "806-495-2485" } }; context.AddRange(clients); context.SaveChanges(); // CLIENTS if (context.Members.Any()) { //leave, there is already data in the database return; } var members = new List <Member> { new Member { FirstName = "Charles", LastName = "Coufal", Major = "CIS", Email = "*****@*****.**", Phone = "806-367-3979" }, new Member { FirstName = "Aaron", LastName = "Herbert", Major = "CIS", Email = "*****@*****.**", Phone = "806-395-9433" }, new Member { FirstName = "Matt", LastName = "Webb", Major = "CIS", Email = "*****@*****.**", Phone = "806-748-3958" }, new Member { FirstName = "Laith", LastName = "Junior", Major = "CIS", Email = "*****@*****.**", Phone = "806-395-4954" }, new Member { FirstName = "Alex", LastName = "Roder", Major = "CIS", Email = "*****@*****.**", Phone = "806-945-3984" }, new Member { FirstName = "Quan", LastName = "Nguyen", Major = "CIS", Email = "*****@*****.**", Phone = "806-945-3943" }, new Member { FirstName = "Catherine", LastName = "McGovern", Major = "CIS", Email = "*****@*****.**", Phone = "806-395-3854" }, new Member { FirstName = "Todd", LastName = "Kile", Major = "CIS", Email = "*****@*****.**", Phone = "806-945-4859" }, new Member { FirstName = "Amy", LastName = "Sayso", Major = "CIS", Email = "*****@*****.**", Phone = "806-495-8584" }, new Member { FirstName = "Cory", LastName = "Williams", Major = "CIS", Email = "*****@*****.**", Phone = "806-495-4856" } }; context.AddRange(members); context.SaveChanges(); // PROJECTS if (context.Projects.Any()) { //leave, there is already data in the database return; } var projects = new List <Project> { new Project { ProjectName = "Google 2.0", ProjectDescription = "Making Google twice as good." }, new Project { ProjectName = "The New Website", ProjectDescription = "Creating a new website." }, new Project { ProjectName = "Update Payment System", ProjectDescription = "Updating the company's online payment system." } }; context.AddRange(projects); context.SaveChanges(); //PROJECT ROSTER BRIDGE TABLE - THERE MUST BE PROJECTS AND PARTICIPANTS MADE FIRST if (context.ProjectRoster.Any()) { //leave, there is already data in the database return; } //quickly grab the recent records added to the DB to get the IDs var projectsFromDb = context.Projects.ToList(); var clientsFromDb = context.Clients.ToList(); var membersFromDb = context.Members.ToList(); var projectroster = new List <ProjectRoster> { //take the first project from above, the first client from above, and the first three students from above. new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = clientsFromDb.ElementAt(0).ID.ToString(), ProjectParticipant = clientsFromDb.ElementAt(0) }, new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = membersFromDb.ElementAt(0).ID.ToString(), ProjectParticipant = membersFromDb.ElementAt(0) }, new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = membersFromDb.ElementAt(1).ID.ToString(), ProjectParticipant = membersFromDb.ElementAt(1) }, new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = membersFromDb.ElementAt(2).ID.ToString(), ProjectParticipant = membersFromDb.ElementAt(2) }, }; context.AddRange(projectroster); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new BuffteksWebsiteContext(serviceProvider.GetRequiredService <DbContextOptions <BuffteksWebsiteContext> >())) { // CLIENTS if (context.Clients.Any()) { //leave, there is already data in the database return; } var clients = new List <Client> { new Client { FirstName = "Jack", LastName = "Daniels", CompanyName = "Whiskey Inc.", Email = "*****@*****.**", Phone = "123-456-7890" }, new Client { FirstName = "Kristen", LastName = "Bell", CompanyName = "Frozen Industries", Email = "*****@*****.**", Phone = "332-552-5675" }, new Client { FirstName = "Michelle", LastName = "Obama", CompanyName = "White House Inc.", Email = "*****@*****.**", Phone = "882-338-7550" } }; context.AddRange(clients); context.SaveChanges(); // CLIENTS if (context.Members.Any()) { //leave, there is already data in the database return; } var members = new List <Member> { new Member { FirstName = "Maggie", LastName = "Sanchez", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "Peter", LastName = "Perez", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "Jessica", LastName = "Williams", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "Layla", LastName = "Washington", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "Dylan", LastName = "Burns", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "Rachael", LastName = "Morris", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "Sam", LastName = "Smith", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "Beyonce", LastName = "Knowles-Carter", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "Aubrey", LastName = "Gram", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "James", LastName = "Arnold", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" } }; context.AddRange(members); context.SaveChanges(); // PROJECTS if (context.Projects.Any()) { //leave, there is already data in the database return; } var projects = new List <Project> { new Project { ProjectName = "Sandwhiches", ProjectDescription = "Branching into the food industry" }, new Project { ProjectName = "Ice Delivery", ProjectDescription = "Delivering ice to people of Arendelle" }, new Project { ProjectName = "Stay Fit", ProjectDescription = "Fitness" } }; context.AddRange(projects); context.SaveChanges(); //PROJECT ROSTER BRIDGE TABLE - THERE MUST BE PROJECTS AND PARTICIPANTS MADE FIRST if (context.ProjectRoster.Any()) { //leave, there is already data in the database return; } //quickly grab the recent records added to the DB to get the IDs var projectsFromDb = context.Projects.ToList(); var clientsFromDb = context.Clients.ToList(); var membersFromDb = context.Members.ToList(); var projectroster = new List <ProjectRoster> { //take the first project from above, the first client from above, and the first three students from above. new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = clientsFromDb.ElementAt(0).ID.ToString(), ProjectParticipant = clientsFromDb.ElementAt(0) }, new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = membersFromDb.ElementAt(0).ID.ToString(), ProjectParticipant = membersFromDb.ElementAt(0) }, new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = membersFromDb.ElementAt(1).ID.ToString(), ProjectParticipant = membersFromDb.ElementAt(1) }, new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = membersFromDb.ElementAt(2).ID.ToString(), ProjectParticipant = membersFromDb.ElementAt(2) }, }; context.AddRange(projectroster); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var db = new BuffteksWebsiteContext(serviceProvider.GetRequiredService <DbContextOptions <BuffteksWebsiteContext> >())) { db.Database.EnsureCreated(); if (!db.Projects.Any() && !db.Clients.Any() && !db.Members.Any()) { // CLIENTS var clients = new List <Client> { new Client { FirstName = "Mason", LastName = "McCollum", CompanyName = "Pantex", Email = "*****@*****.**", Phone = "806-567-3854" }, new Client { FirstName = "Daniel", LastName = "Hix", CompanyName = "Nasa", Email = "*****@*****.**", Phone = "218-457-4679" }, new Client { FirstName = "Jessi", LastName = "Cundiff", CompanyName = "Fox", Email = "*****@*****.**", Phone = "646-973-4356" } }; db.AddRange(clients); // Members var members = new List <Member> { new Member { FirstName = "John", LastName = "Doe", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "Jane", LastName = "Doe", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "Donald", LastName = "Trump", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "Barrack", LastName = "Obama", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "George", LastName = "Bush", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "Ted", LastName = "Cruz", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "Bill", LastName = "Clinton", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "Franklin", LastName = "Rossevelt", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "George", LastName = "Washington", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "John", LastName = "Adams", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" } }; db.AddRange(members); //Projects var projects = new List <Project> { new Project { ProjectName = "The Manhattan Project", ProjectDescription = "Goal: Create the biggest stick to slap other countries with *Evil Laugh*" }, new Project { ProjectName = "Terrocata Soldiers", ProjectDescription = "Our dead emperer needs clay defenders!" }, new Project { ProjectName = "Sugar", ProjectDescription = "We literally just need to make some sugar for this super awesome cake" } }; db.AddRange(projects); db.SaveChanges(); } else { //database has already been seeded return; } //PROJECT ROSTER BRIDGE TABLE - THERE MUST BE PROJECTS AND PARTICIPANTS MADE FIRST if (!db.ProjectRoster.Any()) { //quickly grab the recent records added to the DB to get the IDs var projectsFromDb = db.Projects.ToList(); var clientsFromDb = db.Clients.ToList(); var membersFromDb = db.Members.ToList(); var projectroster = new List <ProjectRoster> { //take the first project from above, the first client from above, and the first three students from above. new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = clientsFromDb.ElementAt(0).ID.ToString(), ProjectParticipant = clientsFromDb.ElementAt(0) }, new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = membersFromDb.ElementAt(0).ID.ToString(), ProjectParticipant = membersFromDb.ElementAt(0) }, new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = membersFromDb.ElementAt(1).ID.ToString(), ProjectParticipant = membersFromDb.ElementAt(1) }, new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = membersFromDb.ElementAt(2).ID.ToString(), ProjectParticipant = membersFromDb.ElementAt(2) }, }; db.AddRange(projectroster); db.SaveChanges(); } else { return; } } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new BuffteksWebsiteContext( serviceProvider.GetRequiredService <DbContextOptions <BuffteksWebsiteContext> >())) { // Look for any movies. if (context.Client.Any()) { return; // DB has been seeded } context.Client.AddRange( new Client { //ClientID = 1, Company = "Chop Chop", CompanyContactFirstName = "John", CompanyContactLastName = "Jacob", Email = "*****@*****.**", Phone = "888-888-1789" }, new Client { //ClientID = 2, Company = "Baker Street", CompanyContactFirstName = "Sherlock", CompanyContactLastName = "Holmes", Email = "*****@*****.**", Phone = "888-888-1564" }, new Client { //ClientID = 3, Company = "ConstructionCo", CompanyContactFirstName = "Jim", CompanyContactLastName = "Moriarty", Email = "*****@*****.**", Phone = "888-888-6469" } ); if (context.Project.Any()) { return; // DB has been seeded } context.Project.AddRange( new Project { //ProjectID = 1, ProjectName = "Chop Chop Website", CompanyContactLastName = "Jacob", CompanyName = "Chop Chop", CompanyPhone = "888-888-1789", CompanyEmail = "*****@*****.**", MemberLeadFirstName = "Brett", MemberLeadLastName = "Ponder", MemberLeadPhone = "888-888-1234", MemberLeadEmail = "*****@*****.**" }, new Project { // ProjectID = 2, ProjectName = "Baker Street Website", CompanyContactLastName = "Holmes", CompanyName = "Baker Street", CompanyPhone = "888-888-1564", CompanyEmail = "*****@*****.**", MemberLeadFirstName = "Vanessa", MemberLeadLastName = "Valenzuela", MemberLeadPhone = "888-888-5678", MemberLeadEmail = "*****@*****.**" }, new Project { //ProjectID = 2, ProjectName = "ConstructionCo Website", CompanyContactLastName = "Moriarty", CompanyName = "ConstructionCo", CompanyPhone = "888-888-6469", CompanyEmail = "*****@*****.**", MemberLeadFirstName = "Gabby", MemberLeadLastName = "Ashley", MemberLeadPhone = "888-888-1235", MemberLeadEmail = "*****@*****.**" } ); if (context.Member.Any()) { return; // DB has been seeded } context.Member.AddRange( new Member { //MemberID = 1, FirstName = "Brett", LastName = "Ponder", Standing = "Senior", Major = "CIS", Birthday = "1/1/90", Email = "*****@*****.**", Phone = "888-888-1234" }, new Member { //MemberID = 2, FirstName = "Vanessa", LastName = "Valenzuela", Standing = "Junior", Major = "CIS", Birthday = "1/1/92", Email = "*****@*****.**", Phone = "888-888-5678" }, new Member { // MemberID = 3, FirstName = "Gabby", LastName = "Ashley", Standing = "Senior", Major = "CIS", Birthday = "1/1/93", Email = "*****@*****.**", Phone = "888-888-1235" } ); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new BuffteksWebsiteContext(serviceProvider.GetRequiredService <DbContextOptions <BuffteksWebsiteContext> >())) { try { //no matter what, delete and then create context.Database.EnsureDeleted(); context.Database.EnsureCreated(); // CLIENTS if (context.Clients.Any()) { //leave, there is already data in the database return; } var clients = new List <Client> { new Client { FirstName = "Tanja ", LastName = "Sandi", CompanyName = "ZWT Enterprises", Email = "*****@*****.**", Phone = "684-891-3451" }, new Client { FirstName = "Eren", LastName = "Ilithyia", CompanyName = "Wizards of the Coast Inc.", Email = "*****@*****.**", Phone = "143-456-7865" }, new Client { FirstName = "Martin", LastName = "Biagino", CompanyName = "Biagino Home Repair", Email = "*****@*****.**", Phone = "714-739-5237" } }; context.AddRange(clients); context.SaveChanges(); // CLIENTS if (context.Members.Any()) { //leave, there is already data in the database return; } var members = new List <Member> { new Member { FirstName = "Laith", LastName = "Alfaloujeh", Major = "CIS", Email = "*****@*****.**", Phone = "345-484-4685" }, new Member { FirstName = "Mekkala", LastName = "Bourapa", Major = "CIS", Email = "*****@*****.**", Phone = "456-345-5693" }, new Member { FirstName = "Charles", LastName = "Coufal", Major = "CIS", Email = "*****@*****.**", Phone = "579-678-4569" }, new Member { FirstName = "John", LastName = "Cunningham", Major = "CIS", Email = "*****@*****.**", Phone = "862-234-5762" }, new Member { FirstName = "Michael", LastName = "Hayes", Major = "CIS", Email = "*****@*****.**", Phone = "324-234-6852" }, new Member { FirstName = "Aaron", LastName = "Hebert", Major = "CIS", Email = "*****@*****.**", Phone = "345-756-7854" }, new Member { FirstName = "Yi Fu", LastName = "Ji", Major = "CIS", Email = "*****@*****.**", Phone = "678-547-5694" }, new Member { FirstName = "Todd", LastName = "Kile", Major = "CIS", Email = "*****@*****.**", Phone = "324-475-2341" }, new Member { FirstName = "Mara", LastName = "Kinoff", Major = "CIS", Email = "*****@*****.**", Phone = "243-761-5468" }, new Member { FirstName = "Cesareo", LastName = "Lona", Major = "CIS", Email = "*****@*****.**", Phone = "546-456-3524" }, new Member { FirstName = "Michaael", LastName = "Matthews", Major = "CIS", Email = "*****@*****.**", Phone = "243-557-7861" }, new Member { FirstName = "Mason", LastName = "McCollum", Major = "CIS", Email = "*****@*****.**", Phone = "851-456-4756" }, new Member { FirstName = "Alexander", LastName = "McDonald", Major = "CIS", Email = "*****@*****.**", Phone = "345-573-5675" }, new Member { FirstName = "Catherine", LastName = "McGovern", Major = "CIS", Email = "*****@*****.**", Phone = "756-786-4765" }, new Member { FirstName = "Phelps", LastName = "Merrell", Major = "CIS", Email = "*****@*****.**", Phone = "867-125-0512" }, new Member { FirstName = "Quan", LastName = "Nguyen", Major = "CIS", Email = "*****@*****.**", Phone = "551-435-5841" }, new Member { FirstName = "Alex", LastName = "Roder", Major = "CIS", Email = "*****@*****.**", Phone = "865-456-7653" }, new Member { FirstName = "Amy", LastName = "Saysouriyosack", Major = "CIS", Email = "*****@*****.**", Phone = "234-712-6523" }, new Member { FirstName = "Claudia", LastName = "Silva", Major = "CIS", Email = "*****@*****.**", Phone = "756-752-6735" }, new Member { FirstName = "Gabriela", LastName = "Valenzuela", Major = "CIS", Email = "*****@*****.**", Phone = "325-562-5668" }, new Member { FirstName = "Kayla", LastName = "Washington", Major = "CIS", Email = "*****@*****.**", Phone = "876-751-1237" }, new Member { FirstName = "Matthew", LastName = "Webb", Major = "CIS", Email = "*****@*****.**", Phone = "906-856-4355" }, new Member { FirstName = "Cory", LastName = "Williams", Major = "CIS", Email = "*****@*****.**", Phone = "173-455-7413" } }; context.AddRange(members); context.SaveChanges(); // PROJECTS if (context.Projects.Any()) { //leave, there is already data in the database return; } var projects = new List <Project> { new Project { ProjectName = "Build a Website", ProjectDescription = "Customer wants site to rival Amazon on a budget of -$0." }, new Project { ProjectName = "Build a game", ProjectDescription = "Bethesda needs help fixing Fallout 76." }, new Project { ProjectName = "Build a new internet", ProjectDescription = "The one we have now is lame, so we should start over." } }; context.AddRange(projects); context.SaveChanges(); //PROJECT ROSTER BRIDGE TABLE - THERE MUST BE PROJECTS AND PARTICIPANTS MADE FIRST if (context.ProjectRoster.Any()) { //leave, there is already data in the database return; } //quickly grab the recent records added to the DB to get the IDs var projectsFromDb = context.Projects.ToList(); var clientsFromDb = context.Clients.ToList(); var membersFromDb = context.Members.ToList(); var projectroster = new List <ProjectRoster> { //take the first project from above, the first client from above, and the first three students from above. new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = clientsFromDb.ElementAt(0).ID.ToString(), ProjectParticipant = clientsFromDb.ElementAt(0) }, new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = membersFromDb.ElementAt(0).ID.ToString(), ProjectParticipant = membersFromDb.ElementAt(0) }, new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = membersFromDb.ElementAt(1).ID.ToString(), ProjectParticipant = membersFromDb.ElementAt(1) }, new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = membersFromDb.ElementAt(2).ID.ToString(), ProjectParticipant = membersFromDb.ElementAt(2) }, }; context.AddRange(projectroster); context.SaveChanges(); } catch (Exception exp) { Console.WriteLine(exp.Message); } } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new BuffteksWebsiteContext(serviceProvider.GetRequiredService <DbContextOptions <BuffteksWebsiteContext> >())) { // CLIENTS if (context.Clients.Any()) { //leave, there is already data in the database return; } var clients = new List <Client> { new Client { FirstName = "Tina", LastName = "Fey", CompanyName = "funny.com", Email = "funny.com", Phone = "265-369-8875" }, new Client { FirstName = "Marion", LastName = "Spikes", CompanyName = "Unicron Limited", Email = "*****@*****.**", Phone = "209-668-3258" }, new Client { FirstName = "Samuel", LastName = "Compton", CompanyName = "trees are us", Email = "*****@*****.**", Phone = "123-587-4171" } }; context.AddRange(clients); context.SaveChanges(); // CLIENTS if (context.Members.Any()) { //leave, there is already data in the database return; } var members = new List <Member> { new Member { FirstName = "Vera", LastName = "Wang", Major = "CIS", Email = "*****@*****.**", Phone = "658-211-8756" }, new Member { FirstName = "Andy", LastName = "Warhol", Major = "CIS", Email = "*****@*****.**", Phone = "809-699-1166" }, new Member { FirstName = "Roz", LastName = "Chast", Major = "CIS", Email = "*****@*****.**", Phone = "206-234-8877" }, new Member { FirstName = "Maury", LastName = "Povich", Major = "CIS", Email = "*****@*****.**", Phone = "209-935-3336" }, new Member { FirstName = "Dena", LastName = "Batrice", Major = "CIS", Email = "*****@*****.**", Phone = "107-020-2008" }, new Member { FirstName = "Myra", LastName = "Kalman", Major = "CIS", Email = "*****@*****.**", Phone = "225-598-4007" }, new Member { FirstName = "Cheryl", LastName = "Swopes", Major = "CIS", Email = "*****@*****.**", Phone = "339-205-9779" }, new Member { FirstName = "Juno", LastName = "Harrington", Major = "CIS", Email = "*****@*****.**", Phone = "663-020-2008" }, new Member { FirstName = "Dayton", LastName = "Harmon", Major = "CIS", Email = "*****@*****.**", Phone = "389-598-4007" }, new Member { FirstName = "Merna", LastName = "Tina", Major = "CIS", Email = "*****@*****.**", Phone = "336-205-9779" } }; context.AddRange(members); context.SaveChanges(); // PROJECTS if (context.Projects.Any()) { //leave, there is already data in the database return; } var projects = new List <Project> { new Project { ProjectName = "Taquito Tavern", ProjectDescription = "Taquito's Rule" }, new Project { ProjectName = "Awesome Possom", ProjectDescription = "Possums are the new cats on the Interwebs" }, new Project { ProjectName = "Unicorns Unite", ProjectDescription = "Because, Unicorns" } }; context.AddRange(projects); context.SaveChanges(); //PROJECT ROSTER BRIDGE TABLE - THERE MUST BE PROJECTS AND PARTICIPANTS MADE FIRST if (context.ProjectRoster.Any()) { //leave, there is already data in the database return; } //quickly grab the recent records added to the DB to get the IDs var projectsFromDb = context.Projects.ToList(); var clientsFromDb = context.Clients.ToList(); var membersFromDb = context.Members.ToList(); var projectroster = new List <ProjectRoster> { //take the first project from above, the first client from above, and the first three students from above. new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = clientsFromDb.ElementAt(0).ID.ToString(), ProjectParticipant = clientsFromDb.ElementAt(0) }, new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = membersFromDb.ElementAt(0).ID.ToString(), ProjectParticipant = membersFromDb.ElementAt(0) }, new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = membersFromDb.ElementAt(1).ID.ToString(), ProjectParticipant = membersFromDb.ElementAt(1) }, new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = membersFromDb.ElementAt(2).ID.ToString(), ProjectParticipant = membersFromDb.ElementAt(2) }, }; context.AddRange(projectroster); context.SaveChanges(); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new BuffteksWebsiteContext(serviceProvider.GetRequiredService <DbContextOptions <BuffteksWebsiteContext> >())) { // CLIENTS if (context.Clients.Any()) { //leave, there is already data in the database return; } var clients = new List <Client> { new Client { FirstName = "Jimmie", LastName = "Ramos", CompanyName = "ACME", Email = "*****@*****.**", Phone = "555-555-5555" }, new Client { FirstName = "Kristy", LastName = "Miles", CompanyName = "World Wide Industries", Email = "*****@*****.**", Phone = "555-555-5555" }, new Client { FirstName = "Shelley", LastName = "Walker", CompanyName = "Big Money Inc", Email = "*****@*****.**", Phone = "555-555-5555" } }; context.AddRange(clients); context.SaveChanges(); // CLIENTS if (context.Members.Any()) { //leave, there is already data in the database return; } var members = new List <Member> { new Member { FirstName = "John", LastName = "Cunningham", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "Michael", LastName = "Matthews", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "Mara", LastName = "Kiniff", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "Amy", LastName = "Saysouriyosack", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "Vanessa", LastName = "Valenzuela", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "Claudia", LastName = "Silva", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" }, new Member { FirstName = "Kayla", LastName = "Washington", Major = "CIS", Email = "*****@*****.**", Phone = "555-555-5555" } }; context.AddRange(members); context.SaveChanges(); // PROJECTS if (context.Projects.Any()) { //leave, there is already data in the database return; } var projects = new List <Project> { new Project { ProjectName = "The Big One", ProjectDescription = "The One Project to rule them all" }, new Project { ProjectName = "Awesome", ProjectDescription = "This project is awesome" }, new Project { ProjectName = "Easy Project", ProjectDescription = "This project is so easy, it completes itself" } }; context.AddRange(projects); context.SaveChanges(); //PROJECT ROSTER BRIDGE TABLE - THERE MUST BE PROJECTS AND PARTICIPANTS MADE FIRST if (context.ProjectRoster.Any()) { //leave, there is already data in the database return; } //quickly grab the recent records added to the DB to get the IDs var projectsFromDb = context.Projects.ToList(); var clientsFromDb = context.Clients.ToList(); var membersFromDb = context.Members.ToList(); var projectroster = new List <ProjectRoster> { //take the first project from above, the first client from above, and the first three students from above. new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = clientsFromDb.ElementAt(0).ID.ToString(), ProjectParticipant = clientsFromDb.ElementAt(0) }, new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = membersFromDb.ElementAt(0).ID.ToString(), ProjectParticipant = membersFromDb.ElementAt(0) }, new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = membersFromDb.ElementAt(1).ID.ToString(), ProjectParticipant = membersFromDb.ElementAt(1) }, new ProjectRoster { ProjectID = projectsFromDb.ElementAt(0).ID.ToString(), Project = projectsFromDb.ElementAt(0), ProjectParticipantID = membersFromDb.ElementAt(2).ID.ToString(), ProjectParticipant = membersFromDb.ElementAt(2) }, }; context.AddRange(projectroster); context.SaveChanges(); } }