Exemple #1
0
        private void SaveComment()
        {
            PtNewComment commentNew = new PtNewComment
            {
                ItemId = Item.Id,
                Title  = NewCommentTitle,
                UserId = CURRENT_USER_ID
            };

            RpsCommentsRepo.AddNewComment(commentNew);
        }
        private void SaveComment()
        {
            PtNewComment commentNew = new PtNewComment
            {
                ItemId = ChitchatFormVm.ItemId,
                Title  = ChitchatFormVm.NewCommentText,
                UserId = CURRENT_USER_ID
            };

            rpsCommentsRepo.AddNewComment(commentNew);
        }
        public PtComment AddNewComment(PtNewComment newComment)
        {
            var item = context.PtItems.Single(i => i.Id == newComment.ItemId);

            PtComment comment = new PtComment
            {
                Id           = item.Comments.Max(t => t.Id) + 1,
                Title        = newComment.Title,
                DateCreated  = DateTime.Now,
                DateModified = DateTime.Now,
                User         = context.PtUsers.Find(u => u.Id == newComment.UserId)
            };

            item.Comments.Insert(0, comment);
            return(comment);
        }
Exemple #4
0
        public ActionResult Chitchat(int id, PtItemCommentsVm vm)
        {
            ViewBag.screen = DetailScreenEnum.Chitchat;

            try
            {
                PtNewComment commentNew = new PtNewComment
                {
                    ItemId = id,
                    Title  = vm.NewCommentText,
                    UserId = CURRENT_USER_ID
                };

                rpsCommentsRepo.AddNewComment(commentNew);

                return(RedirectToAction("Chitchat"));
            }
            catch
            {
                return(RedirectToAction("Chitchat"));
            }
        }