public ActionResult <Celeb> PostCeleb(int gameId, Celeb celeb) { if (gameId != celeb.GameId) { throw new ArgumentException($"gameId: {gameId} doesn't equal game id in celeb: {celeb.GameId}"); } return(_gameService.AddCeleb(celeb)); }
public IActionResult AddNewCeleb(CelebAndGamePageModel pageModel) { _logger.LogDebug($"Adding celeb {pageModel.Celeb.Name} to game {pageModel.Celeb.GameId}"); var savedCeleb = _gameService.AddCeleb(pageModel.Celeb); CelebAndGamePageModel newPageModel = new CelebAndGamePageModel { ThisGame = _gameService.GetGameById(savedCeleb.GameId), Celeb = new Celeb() }; return(View("EnterCeleb", newPageModel)); }