示例#1
0
        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);
        }
示例#2
0
 public IActionResult AddJoke(Guid gameId, [FromBody] UpsertJokeDTO dto)
 {
     this._gameService.AddJoke(gameId, dto);
     return(Ok());
 }