public static void Add() { var sqlSever = new SqlServerDbContext(); string[] teams = new string[5]; teams[0] = "Razors"; teams[1] = "Overpowered"; teams[2] = "Fire"; teams[3] = "Extreme"; teams[4] = "Core"; foreach (var team in teams) { if (sqlSever.Teams.Any(t => t.Name == team)) { } else { Team teamToAdd = new Team(team); sqlSever.Teams.Add(teamToAdd); } } sqlSever.SaveChanges(); }
public static void Add() { var sqlSever = new SqlServerDbContext(); string[] specialities = new string[9]; specialities[0] = "UX Designer"; specialities[1] = "Javascript Developer"; specialities[2] = ".Net Developer"; specialities[3] = "QA Developer"; specialities[4] = "System Administrator"; specialities[5] = "C++ Developer"; specialities[6] = "Database Developer"; specialities[7] = "Embedded Programer"; specialities[8] = "Software Architect"; foreach (var sp in specialities) { if (sqlSever.Specialities.Any(s => s.Name == sp)) { } else { Speciality speciality = new Speciality(sp); sqlSever.Specialities.Add(speciality); } } sqlSever.SaveChanges(); }
public static void Add(List <Bug> bugs) { var sqlSever = new SqlServerDbContext(); foreach (var bug in bugs) { if (sqlSever.Bugs.Any(b => b.Description == bug.Description)) { } else { sqlSever.Bugs.Add(bug); } } sqlSever.SaveChanges(); }
// logic moved to SqlServerInitializer // TODO delete private static void Add() { var sqlSever = new SqlServerDbContext(); string[] priorities = new string[4]; priorities[0] = "Urgent"; priorities[1] = "Important"; priorities[2] = "Not Important"; priorities[3] = "Don't care"; foreach (var pr in priorities) { if (sqlSever.Priorities.Any(p => p.Name == pr)) { } else { Priority priority = new Priority(pr); sqlSever.Priorities.Add(priority); } } sqlSever.SaveChanges(); }