예제 #1
0
 public List <Team> ImportTeams()
 {
     using (BloggingDbContext db = new BloggingDbContext())
     {
         return(new List <Team>(db.Teams));
     }
 }
예제 #2
0
 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();
     }
 }
예제 #3
0
 public void ExportTeamMatches(ref List <TeamMatch> teamMatches)
 {
     using (BloggingDbContext db = new BloggingDbContext())
     {
         foreach (var teamMatch in teamMatches)
         {
             db.TeamMatches.Add(teamMatch);
         }
         db.SaveChanges();
     }
 }
예제 #4
0
 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();
     }
 }