public void GetTeambyIDTEST(int ID, string expectedTeamName) { TeamOperations teamOps = new TeamOperations(); Team testTeam = teamOps.GetTeams().SingleOrDefault(m => m.TeamID == ID); string team = testTeam.TeamName; Assert.AreEqual(team, expectedTeamName); }
static void Main(string[] args) { TeamOperations teamOps = new TeamOperations(); Console.WriteLine("What would you like to do? Please enter a number"); Console.WriteLine("1.Check out our current teams?"); Console.WriteLine("2.Want to add a prospective team for us to Consider?"); Console.WriteLine("3.Find a specific team by their TeamID"); string userInput = Console.ReadLine(); if (userInput == "2") { teamOps.AddTeam(); } if (userInput == "1") { teamOps.DisplayTeams(); Console.ReadLine(); } if (userInput == "3") { Console.Clear(); Console.WriteLine("What is their ID?"); int result = int.Parse(Console.ReadLine()); Team team = teamOps.GetTeamByID(result); Console.WriteLine("Team Name: {0}", team.TeamName); Console.WriteLine("Active Team?: {0}", team.Active); Console.WriteLine("Average Salary: {0}", team.AverageSalary); Console.WriteLine("Head Coach Name: {0}", team.Coach); Console.WriteLine("Number of CONVICTIONS: {0}", team.ConvictionsCount); Console.WriteLine("Name of Mascot: {0}", team.Mascot); Console.WriteLine("Name of Sport: {0}", team.sport); Console.WriteLine("Name of Stadium: {0}", team.Venue.Building); Console.WriteLine("Year\n", team.Year); Console.ReadLine(); } }
public void AddTeam() { using (var TC = new TeamContext()) { Console.Clear(); TeamOperations teamOps = new TeamOperations(); Team newTeam = new Team(); Venue venue = new Venue(); Console.WriteLine("What would you like them to be called?"); newTeam.TeamName = Console.ReadLine(); Console.WriteLine("What sport do they play?"); newTeam.sport = Console.ReadLine(); Console.WriteLine("Where in Minnesota would they be located?"); venue.City = Console.ReadLine(); Console.WriteLine("What about a mascot?"); newTeam.Mascot = Console.ReadLine(); var years = new Years() { YearsFounded = null, YearDisbanded = null }; var championships = new Champs() { ChampYear = null, Title = null }; TC.Championships.Add(championships); TC.Years.Add(years); TC.Venues.Add(venue); TC.Teams.Add(newTeam); TC.SaveChanges(); } }