예제 #1
0
        public IActionResult EditComment(int Id)
        {
            List <CommentModel> Com  = new List <CommentModel>();
            List <FlagModel>    List = new List <FlagModel>();
            var com  = GetComment(Id);
            var list = GetReason(Id);

            foreach (var item in list)
            {
                List.Add(new FlagModel
                {
                    CommentId = item.CommentId,
                    Reason    = item.Reason
                });
            }

            foreach (var row in com)
            {
                if (row.Flag == true)
                {
                    Com.Add(new CommentModel
                    {
                        CommentId   = row.CommentId,
                        Comment     = row.Comment,
                        Name        = row.Names,
                        Flag        = row.Flag,
                        ImageId     = row.ImageId,
                        FlagModel   = List[0],
                        CommentDate = row.CommentDate.ToShortDateString()
                    });
                }
                else
                {
                    Com.Add(new CommentModel
                    {
                        CommentId   = row.CommentId,
                        Comment     = row.Comment,
                        Name        = row.Names,
                        Flag        = row.Flag,
                        ImageId     = row.ImageId,
                        CommentDate = row.CommentDate.ToShortDateString()
                    });
                }
            }
            CommentModel test = new CommentModel();

            test = Com[0];

            return(View(test));
        }
 public IActionResult FlagComment(ImageUpload.Models.CommentModel model)
 {
     CreateFlag(model.FlagModel.CommentId, model.FlagModel.Reason);
     Flag(model.FlagModel.CommentId, true);
     return(RedirectToAction("ViewPost", new { Id = model.ImageId }));
 }