public List <Team> ImportTeams() { using (BloggingDbContext db = new BloggingDbContext()) { return(new List <Team>(db.Teams)); } }
public void WipeData() { using (BloggingDbContext db = new BloggingDbContext()) { List <Team> teams = new List <Team>(db.Teams); List <TeamMatch> teamMatches = new List <TeamMatch>(db.TeamMatches); db.Teams.RemoveRange(teams); db.TeamMatches.RemoveRange(teamMatches); db.SaveChanges(); } }
public void ExportTeamMatches(ref List <TeamMatch> teamMatches) { using (BloggingDbContext db = new BloggingDbContext()) { foreach (var teamMatch in teamMatches) { db.TeamMatches.Add(teamMatch); } db.SaveChanges(); } }
public void ShowData() { using (BloggingDbContext db = new BloggingDbContext()) { List <Team> teams = new List <Team>(db.Teams.OrderBy(t => t.Place)); Console.WriteLine(); foreach (var team in teams) { Console.WriteLine(team.Place + ".\t" + team.Name + "\t" + team.Point + " points"); } Console.WriteLine(); } }