public ActionResult Create(IFormCollection collection) { try { gameGame.AddGame(collection); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public async Task <IActionResult> AddNewGame(NewGameModel model) { if (!ModelState.IsValid) { return(RedirectToAction("AddGame", "Game")); } var game = BuildGame(model); await _game.AddGame(game); model.Id = game.Id; if (model.ImageUpload != null) { await UploadGameImageAsync(model); } return(RedirectToAction("Index", "Game")); }