Пример #1
0
        public async Task <ActionResult> getComment(int id)
        {
            //  var comments = commSer.GetCommentsByArticle(id);
            var comms = await commSer.FindAllAsync(t => t.article.idArticle == id);

            List <CommentViewModels> gVM = new List <CommentViewModels>();

            foreach (var item in comms)
            {
                // var games = artSer.GetById(item.idArticle);
                // var name = games.name;
                CommentViewModels cm = new CommentViewModels()
                {
                    idArticle   = item.idArticle,
                    idUser      = item.idUser,
                    description = item.description,
                    date        = item.date,
                    user        = item.user,
                    article     = item.article,
                };

                gVM.Add(cm);
            }
            return(View(gVM));
        }