public void AddJoke(Guid gameId, UpsertJokeDTO dto) { var game = this.gameRepository.GetById(gameId); var joke = new Joke() { Author = dto.Author, Content = dto.Content, Created = DateTime.Now, Number = dto.Number }; game.Jokes ??= new List <Joke>(); game.Jokes.Add(joke); this.gameRepository.Update(game); }
public IActionResult AddJoke(Guid gameId, [FromBody] UpsertJokeDTO dto) { this._gameService.AddJoke(gameId, dto); return(Ok()); }