public async Task <IActionResult> Update(Square square, string playerName) { Square squareUpdate = _context.Square .Where(s => s.Id == square.Id) .FirstOrDefault(); if (squareUpdate == null) { return(NotFound()); } try { squareUpdate.PlayerName = TempData["username"].ToString(); _context.Update(squareUpdate); await _context.SaveChangesAsync(); string url = string.Concat("/Square/Index/", squareUpdate.GameId); return(Redirect(url)); } catch (DbUpdateConcurrencyException) { if (!SquareExists(square.Id)) { return(NotFound()); } else { throw; } } }
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)); }
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)); }
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)); }