Пример #1
0
 public ActionResult Create(IFormCollection collection)
 {
     try
     {
         gameGame.AddGame(collection);
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }
Пример #2
0
        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"));
        }