public async Task <ActionResult <Game> > PostGame(Game game) { try { await _gamesService.CreateGameAsync(game); } catch (ArgumentNullException ex) { return(BadRequest(ex.Message)); } return(CreatedAtAction("GetGame", new { id = game.Id }, game)); }
public async Task <IActionResult> OnPost() { if (!ModelState.IsValid) { return(Page()); } Game.PhotoUrl = await _storageService.UploadPhoto(FileManager.FormFile); await _gameService.CreateGameAsync(Game); return(RedirectToPage("./Games")); }