Example #1
0
 public DetailsModel(ProjectManagementWebApp.Data.ProjectManagementContext context,
                     TaskAppService taskAppService,
                     FileAppService fileAppService,
                     CommentAppService commentAppService,
                     IWebHostEnvironment environment
                     )
 {
     _context           = context;
     _taskAppService    = taskAppService;
     _fileAppService    = fileAppService;
     _commentAppService = commentAppService;
     this._environment  = environment;
 }
Example #2
0
        public ActionResult AddComment(CommentModel item)
        {
            var comment = new Comment();

            comment.Text     = item.Text;
            comment.ParentId = item.ParentId;
            comment.PrNumber = item.PrNumber;
            comment.UserId   = "123-456-789";

            CommentAppService commentAppService = new CommentAppService();
            var a = commentAppService.Add(comment);

            return(Json("Success", JsonRequestBehavior.AllowGet));
        }
        public ActionResult Comment(int product_Id, string comment)
        {
            string            User_Id           = User.Identity.GetUserId();
            string            UseName           = User.Identity.Name;
            CommentAppService commentAppService = new CommentAppService();

            commentAppService.InsertComment(User_Id, product_Id, comment);

            IHubContext commentHub = GlobalHost.ConnectionManager.GetHubContext("CommentHub");

            commentHub.Clients.All.NotifyNewComment(UseName, product_Id, comment);


            return(RedirectToAction("ShowDetails", new { id = product_Id }));
        }
Example #4
0
        public ActionResult Index()
        {
            HttpContext.Session["userid"] = "0001";

            CommentAppService commentAppService = new CommentAppService();
            var items = commentAppService.FindByPrNumber("1100069792");

            FollowAppServ followAppService = new FollowAppServ();
            var           user_follow      = followAppService.FindUserFollowByPRNumber("1100069792", HttpContext.Session["userid"].ToString());

            var commentItems  = items.Where(x => x.ParentId == null);
            var replyItems    = items.Where(x => x.ParentId != null);
            var commentModels = new List <CommentModel>();

            var followModel = new FollowModel();

            foreach (var j in user_follow)
            {
                var follow = ConvertToViewModel_follow(j);
                followModel = follow;
            }

            foreach (var i in commentItems)
            {
                var comment = ConvertToViewModel(i);
                comment.replyComments = new List <CommentModel>();
                var replies = replyItems.Where(x => x.ParentId == i.Id).ToList();
                foreach (var j in replies)
                {
                    var reply = ConvertToViewModel(j);
                    comment.replyComments.Add(reply);
                }
                commentModels.Add(comment);
            }

            var content = new content();

            content.comment_x = new List <CommentModel>();
            content.follow_x  = new FollowModel();

            content.comment_x = commentModels;
            content.follow_x  = followModel;



            return(View(content));
        }
        public ActionResult AddComment(CommentModel item)
        {
            var comment = new Comment();

            comment.Text     = item.Text;
            comment.ParentId = item.ParentId;
            comment.PrNumber = item.PrNumber;
            comment.UserId   = "123-456-789";

            CommentAppService commentAppService = new CommentAppService();
            var result        = commentAppService.Add(comment);
            var resultComment = ConvertToViewModel(result);

            return(Json(new
            {
                isSuccess = true,
                data = resultComment
            }, JsonRequestBehavior.AllowGet));
        }
Example #6
0
        public ActionResult Index()
        {
            CommentAppService commentAppService = new CommentAppService();
            var items = commentAppService.FindByPrNumber("1100069792");

            var commentItems  = items.Where(x => x.ParentId == null);
            var replyItems    = items.Where(x => x.ParentId != null);
            var commentModels = new List <CommentModel>();

            foreach (var i in commentItems)
            {
                var comment = ConvertToViewModel(i);
                comment.replyComments = new List <CommentModel>();
                var replies = replyItems.Where(x => x.ParentId == i.Id).ToList();
                foreach (var j in replies)
                {
                    var reply = ConvertToViewModel(j);
                    comment.replyComments.Add(reply);
                }
                commentModels.Add(comment);
            }

            return(View(commentModels));
        }
 public DeleteModel(ProjectManagementWebApp.Data.ProjectManagementContext context, CommentAppService commentAppService)
 {
     _context           = context;
     _commentAppService = commentAppService;
 }