public void AddVenue(Venue venueToBeAdded) { using (MNSportsTeamContext context = new MNSportsTeamContext()) { context.Venues.Add(venueToBeAdded); context.SaveChanges(); } }
public void AddChamp(Championship champToBeAdded) { using (MNSportsTeamContext context = new MNSportsTeamContext()) { context.Championships.Add(champToBeAdded); context.SaveChanges(); } }
public void AddYear(Year yearToBeAdded) { using (MNSportsTeamContext context = new MNSportsTeamContext()) { context.Years.Add(yearToBeAdded); context.SaveChanges(); } }
public void AddTeam(Team teamToBeAdded) { using (MNSportsTeamContext context = new MNSportsTeamContext()) { context.Teams.Add(teamToBeAdded); context.SaveChanges(); } }
public List<Venue> GetAllVenues() { List<Venue> venueList = new List<Venue>(); using (MNSportsTeamContext context = new MNSportsTeamContext()) { foreach(var venue in context.Venues) { Venue newVenue = new Venue(); newVenue.VenueId = venue.VenueId; newVenue.Building = venue.Building; newVenue.City = venue.City; venueList.Add(newVenue); } } return venueList; }
public void DeleteTeamByName(string teamName) { using (MNSportsTeamContext context = new MNSportsTeamContext()) { var teamToDelete = context.Teams.SingleOrDefault(n => n.Name == teamName); context.Teams.Remove(teamToDelete); context.SaveChanges(); } }
public List<Team> GetAllTeams() { List<Team> teamList = new List<Team>(); using (MNSportsTeamContext context = new MNSportsTeamContext()) { foreach (var team in context.Teams) { Team newTeam = new Team(); newTeam.TeamId = team.TeamId; newTeam.Name = team.Name; newTeam.Sport = team.Sport; newTeam.Mascot = team.Mascot; newTeam.Coach = team.Coach; newTeam.Owner = team.Owner; newTeam.AvgSalary = team.AvgSalary; newTeam.Active = team.Active; newTeam.Convictions = team.Convictions; newTeam.VenueId = team.VenueId; newTeam.YearId = team.YearId; newTeam.Championships = team.Championships; teamList.Add(newTeam); } } return teamList; }