public void UpdateTagComment(string userLogin, long commentId, List <String> tags) { Comment comment = CommentDao.Find(commentId); comment.Tags.Clear(); foreach (var tag in tags) { String tagLower = tag.ToLower(); if (!TagDao.Exists(tagLower)) { Tag newTag = new Tag { tagName = tagLower }; newTag.Comment.Add(comment); TagDao.Create(newTag); comment.Tags.Add(newTag); } else { Tag tagInDatabase = TagDao.Find(tagLower); comment.Tags.Add(tagInDatabase); tagInDatabase.Comment.Add(comment); } } }
/// <exception cref="InstanceNotFoundException"/> public void UpdateComment(long commentId, string commentBody) { Comment comment = CommentDao.Find(commentId); comment.comment1 = commentBody; CommentDao.Update(comment); }
public DTOComment getComment(long commentId) { Comment comment; comment = CommentDao.Find(commentId); //////////FALTA DEVOLVER LOS TAGS DEL COMENTARIO en el DTO return(new DTOComment(commentId, comment.UserProfile.loginName, comment.eventId, comment.comment_description, comment.publishDate, null)); }
public void UpdateComment(long commentId, string comment_text) { Comment comment; comment = CommentDao.Find(commentId); comment.comment_description = comment_text; //UpdateTagComment(commentId,tags); CommentDao.Update(comment); }
public void DeleteComment(long commentId, long userId) { Comment c = CommentDao.Find(commentId); if (c.UserProfile.usrId == userId) { CommentDao.Remove(commentId); //Remove no funciona } else { throw new Exception(); } }
public Comment EditComment(long commentId, long userId, string newComment) { Comment c = CommentDao.Find(commentId); if (c.UserProfile.usrId == userId) { c.content = newComment; CommentDao.Update(c); } else { throw new Exception(); } return(c); }
public ICollection <LabelDto> GetCommentLabels(long commentId) { Comment comment = CommentDao.Find(commentId); ICollection <LabelDto> labelDtos = new List <LabelDto>(); foreach (Label l in comment.Labels) { ICollection <CommentDto> commentsDtos = new List <CommentDto>(); foreach (Comment c in l.Comments) { commentsDtos.Add(new CommentDto(c, c.Event.eventId)); } labelDtos.Add(new LabelDto(l.labelId, l.name, l.commentsNum, commentsDtos)); } return(labelDtos); }
public Comment AddLabel(long commentId, ICollection <Label> labels) { Comment c = CommentDao.Find(commentId); foreach (Label l in labels) { if (!c.Labels.Contains(l)) { c.Labels.Add(l); l.commentsNum++; LabelDao.Update(l); } } CommentDao.Update(c); return(c); }
/// <exception cref="InstanceNotFoundException"/> public void UpdateComment(long commentId, string commentBody, List <long> newTags) { Comment comment = CommentDao.Find(commentId); ICollection <Tag> tags = new List <Tag>(); comment.comment1 = commentBody; comment.Tags.Clear(); foreach (var tagId in newTags) { tags.Add(TagDao.Find(tagId)); } comment.Tags = tags; CommentDao.Update(comment); }
public Comment RemoveLabel(long commentId, ICollection <Label> labels) { Comment comment = CommentDao.Find(commentId); foreach (Label l in labels) { if (comment.Labels.Contains(l)) { comment.Labels.Remove(l); l.commentsNum--; l.Comments.Remove(comment); LabelDao.Update(l); } } CommentDao.Update(comment); return(comment); }
/// <exception cref="InstanceNotFoundException"/> public void DeleteComment(long commentId) { var comment = CommentDao.Find(commentId); CommentDao.Remove(comment.commentId); }
public Comment FindCommentById(long commentId) { return(CommentDao.Find(commentId)); }