Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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));
        }