private void CreateTeamsAndGame(GamePoolContext context, string bowlName, string teamA, string teamB, string network, string gameDateTime) { Team t1 = new Data.Team() { Id = Guid.NewGuid().ToString(), Description = (string.IsNullOrEmpty(teamA)) ? $"{bowlName} Home" : teamA }; Team t2 = new Data.Team() { Id = Guid.NewGuid().ToString(), Description = (string.IsNullOrEmpty(teamB)) ? $"{bowlName} Home" : teamB }; Game g1 = new Data.Game() { HomeTeamId = t1.Id, AwayTeamId = t2.Id, Description = bowlName, Network = network, GameDateTime = gameDateTime, Id = Guid.NewGuid().ToString(), AwayScore = 0, HomeScore = 0 }; context.Teams.Add(t1); context.Teams.Add(t2); context.Games.Add(g1); }
public async Task <ActionResult> Login(LoginViewModel model, string returnUrl) { if (!ModelState.IsValid) { return(View(model)); } PasswordHasher hasher = new PasswordHasher(); string pwdhash = hasher.HashPassword(model.Password); using (GamePool2016.Data.GamePoolContext context = new GamePoolContext()) { //find the user, compare the hash Player player = context.Players.FirstOrDefault(item => item.UserName == model.UserName); if (player == null) { ModelState.AddModelError("", "Invalid user name"); return(View(model)); } else { PasswordVerificationResult result = hasher.VerifyHashedPassword(player.PasswordHash, model.Password); if (result == PasswordVerificationResult.Success)//(player.PasswordHash == pwdhash) { //success HttpCookie cookie = new HttpCookie("UserName", model.UserName); if (model.RememberMe) { cookie.Expires = DateTime.Now.AddYears(1); } Response.Cookies.Add(cookie); FormsAuthentication.SetAuthCookie(model.UserName, true); //return RedirectToLocal(returnUrl); return(RedirectToAction("MyPicks", "Picks")); } else { ModelState.AddModelError("", "Invalid password"); return(View(model)); } } } }
public SpeedTrap(GamePoolContext gamePoolContext, float speed) { _gamePoolContext = gamePoolContext; _speed = speed; }
public DamageTrap(GamePoolContext gamePoolContext, int damage) { _gamePoolContext = gamePoolContext; _damage = damage; }