Esempio n. 1
0
        public async Task <IActionResult> AddComment(int id, string content)
        {
            await using var db = new GameCatalogContext();
            Comment comment = new(){ Content = content, Date = DateTime.Now, GameId = id, UserId = db.Users.FirstOrDefault(user => user.Login == Request.Cookies["Auth"]).Id };
            await _catalog.AddCommentAsync(comment);

            return(RedirectToAction("GamePage", "Game", db.Games.FirstOrDefault(game => game.Id == id)));
        }