public async Task <IActionResult> Create([Bind("BowlerID,Name,Group,InActivity, BowlerAverage, RegisterDate, LeaveDate, Bigo")] Bowler bowler) { if (ModelState.IsValid) { _context.Add(bowler); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(bowler)); }
public async Task <IActionResult> Create([Bind("ID,BowlerID,Year,Average,Bigo")] YearAverage yearAverage) { if (ModelState.IsValid) { _context.Add(yearAverage); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BowlerID"] = new SelectList(_context.Bowlers, "BowlerID", "BowlerID", yearAverage.BowlerID); return(View(yearAverage)); }
public PlayerParty Create(string name, string legalId) { var party = new PlayerParty { Name = name, LegalId = legalId, ScoreAccount = new RoundsScoreAccount() { Entries = new List <RoundsScoreEntry>() }, WinningAccount = new WinningAccount() { Entries = new List <WinningEntry>() } }; _context.Add(party.ScoreAccount); _context.Add(party.WinningAccount); _context.Add(party); _context.SaveChanges(); return(party); }
public GameAccountability AddGameAccountability(PlayerParty playerOne, PlayerParty playerTwo, GameAccountabilityType accountabilityType) { var accountability = new GameAccountability { PlayerOne = playerOne, PlayerTwo = playerTwo, GameType = accountabilityType, TimePoint = DateTime.Now, }; _context.Add(accountability); _context.SaveChanges(); return(accountability); }
public async Task <IActionResult> Create([Bind("Playtime,Place,GameKind,GameContent,bCalTotal,Penalty,Group,bFine, bHandicap, bAward, GameMemo")] Game game) { try { if (ModelState.IsValid) { _context.Add(game); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } } catch (DbUpdateException) { ModelState.AddModelError("", "Game_Create_Error"); } return(View(game)); }