Example #1
0
 public static List <SportsTeam> GetTeams()
 {
     using (var context = new FantasyFootballContext())
     {
         return(context.SportsTeam.ToList());
     }
 }
Example #2
0
 public static List <Player> GetPlayers()
 {
     using (var context = new FantasyFootballContext())
     {
         return(context.Player.ToList());
     }
 }
Example #3
0
 public static void AddTeam(SportsTeam sportsTeam)
 {
     using (var context = new FantasyFootballContext())
     {
         context.SportsTeam.Add(sportsTeam);
         context.SaveChanges();
     }
 }
Example #4
0
 public static void AddPlayer(BasePlayer player)
 {
     using (var context = new FantasyFootballContext())
     {
         context.BasePlayer.Add(player);
         context.SaveChanges();
     }
 }
Example #5
0
 public static void ClearDatabase()
 {
     using (var context = new FantasyFootballContext())
     {
         context.BasePlayer.RemoveRange(context.BasePlayer.ToList());
         context.Player.RemoveRange(context.Player.ToList());
         //context.SportsTeam.RemoveRange(context.SportsTeam.ToList());
         context.SaveChanges();
     }
 }
Example #6
0
 private static Guid?GetTeamId(string team)
 {
     using (var context = new FantasyFootballContext())
     {
         return(context.SportsTeam.FirstOrDefault(sportsTeam =>
                                                  sportsTeam.Name.Contains(team, StringComparison.OrdinalIgnoreCase) ||
                                                  team.Contains(sportsTeam.Name, StringComparison.OrdinalIgnoreCase))
                ?.Id);
     }
 }
Example #7
0
        private static Guid GetLeagueId(string team)
        {
            Guid leagueTeamId = Constants.UnassignedTeamId;

            using (var context = new FantasyFootballContext())
            {
                leagueTeamId = context.LeagueTeam.FirstOrDefault(sportsTeam =>
                                                                 sportsTeam.Name.Contains(team, StringComparison.OrdinalIgnoreCase) ||
                                                                 team.Contains(sportsTeam.Name, StringComparison.OrdinalIgnoreCase))
                               .Id;
            }

            return(leagueTeamId);
        }
Example #8
0
 public Leaguecontroller(UserManager <ApplicationUser> userManager, FantasyFootballContext db)
 {
     _userManager = userManager;
     _db          = db;
 }
Example #9
0
 public AccountController(UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, FantasyFootballContext db)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _db            = db;
 }
 public FantasyFootballUnitOfWork(FantasyFootballContext context)
 {
     this.context = context;
 }