Exemple #1
0
        public bool TryGetThreadForLine(string lineId, out CommentThreadModel threadModel)
        {
            threadModel = null;
            if (lineId == null)
            {
                return(false);
            }

            return(_threads.TryGetValue(lineId, out threadModel));
        }
Exemple #2
0
 public static CommentThread Map(CommentThreadModel objModel)
 {
     return(new CommentThread
     {
         ID = objModel.ID,
         URL = objModel.URL,
         SectionId = objModel.SectionId,
         EntityID = objModel.EntityID
     });
 }
        public async Task <ActionResult> OnPostDeleteAsync(string id, string commentId, string elementId)
        {
            await commentRepository.DeleteCommentAsync(id, commentId);

            var commentArray = await commentRepository.FetchCommentsAsync(id);

            List <CommentModel> comments = commentArray.Comments.Where(comment => comment.ElementId == elementId).ToList();

            CommentThreadModel partialModel = new CommentThreadModel()
            {
                AssemblyId = id,
                Comments   = comments,
                LineId     = Comment.ElementId
            };

            return(new PartialViewResult
            {
                ViewName = "_CommentThreadPartial",
                ViewData = new ViewDataDictionary <CommentThreadModel>(ViewData, partialModel)
            });
        }
        public async Task <ActionResult> OnPostAsync(string id)
        {
            Comment.TimeStamp = DateTime.UtcNow;
            Comment.Username  = User.GetGitHubLogin();
            await commentRepository.UploadCommentAsync(Comment, id);

            var assemblyComments = await commentRepository.FetchCommentsAsync(id);

            var commentArray             = assemblyComments.Comments;
            List <CommentModel> comments = commentArray.Where(comment => comment.ElementId == Comment.ElementId).ToList();

            CommentThreadModel partialModel = new CommentThreadModel()
            {
                AssemblyId = id,
                Comments   = comments,
                LineId     = Comment.ElementId
            };

            return(new PartialViewResult
            {
                ViewName = "_CommentThreadPartial",
                ViewData = new ViewDataDictionary <CommentThreadModel>(ViewData, partialModel)
            });
        }
 public bool TryGetThreadForLine(string lineId, out CommentThreadModel threadModel)
 {
     return(_threads.TryGetValue(lineId, out threadModel));
 }