public CommentNotification( Comment comment, IDataContext context) { this.comment = comment; this.context = context; }
public static CommentViewModel Map(Comment model) { var viewModel = mapper.Map(model); viewModel.AuthorId = model.UserId; viewModel.Author = AuthorMapper.Map(model.User); viewModel.ArticleId = model.ArticleId; return viewModel; }
public void NotifyAboutNewComment(Comment comment) { throw new NotSupportedException(); }
public void Comment(Comment comment) { comment.UserId = GetCurrentUser().Id; PublicationService.Comment(comment); NotificationService.NotifyAboutNewComment(comment); }
public static CommentViewModel Map(Comment comment) { CommentViewModel viewModel = CommentMapper.Map(comment); viewModel.Article = ArticleSmallMapper.Map(comment.Article); return viewModel; }
public void Comment(Comment comment) { comment.PostedDate = DateTime.Now; commentStorage.Add(comment); }
public void Add(Comment comment) { Add(comment, Entities.Comments); }
private void AddComments(IEntity article, string articleInfo) { var comments = Regex.Matches(articleInfo, "(?<=text:).*"); var authors = Regex.Matches(articleInfo, "(?<=author:).*"); for (int i = 0; i < comments.Count; i++) { var comment = new Comment(); comment.ArticleId = article.Id; comment.Text = comments[i].Value; using (var academyEntities = new AcademyEntities()) { var email = authors[i].Value.TrimEnd('\r'); comment.UserId = academyEntities.Users.Single( x => x.Email.Equals(email)).Id; } using (var context = new EfDataContext()) { var publicationService = new PublicationService(context); publicationService.Comment(comment); var notificationService = new NotificationService(context); notificationService.NotifyAboutNewComment(comment); } } }