Пример #1
0
        public async Task <IActionResult> Create([Bind("Id,GameName,GameGenre,Year,Round,Payout")] SquareGame squareGame)
        {
            if (ModelState.IsValid)
            {
                _context.Add(squareGame);
                await _context.SaveChangesAsync();

                CreateNewSquares(squareGame.Id);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(squareGame));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("Id,GameId,SquareId,xVall,yVal")] SquareCard squareCard)
        {
            if (ModelState.IsValid)
            {
                _context.Add(squareCard);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(squareCard));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("Id,UserName,UserPassword")] SquareUser SquareUser)
        {
            if (ModelState.IsValid)
            {
                _context.Add(SquareUser);
                await _context.SaveChangesAsync();

                return(Redirect("/Home/Index"));
            }
            return(View(SquareUser));
        }
Пример #4
0
        public async Task <ActionResult> Assign(int gameId)
        {
            for (int i = 1; i <= 10; i++)
            {
                int x          = GenerateRandomXScore(gameId);
                int y          = GenerateRandomYScore(gameId);
                var squareCard = new SquareCard();

                squareCard.GameId   = gameId;
                squareCard.SquareId = i;
                squareCard.xVall    = x;
                squareCard.yVal     = y;

                _context.Add(squareCard);
                await _context.SaveChangesAsync();
            }

            string url = string.Concat("/Square/Index/", gameId);

            return(Redirect(url));
        }