public CommentViewModel(Comment comment) { this.CommentId = comment.CommentId; this.UserName = comment.UserName; this.Created = comment.Created.ToLocalTime().ToUserFriendlyString(); this.Message = comment.Message; }
public CommentViewModel(Comment comment, Profile user) : this(comment) { this.UserName = user.DisplayName; this.UserAvatarSrc = Gravatar.GetUrl(user.GravatarEmail, 32) + "&d=identicon"; }
public ActionResult PostReviewComment(string reviewId, string message) { var comment = new Comment { Created = DateTime.UtcNow, UserName = this.User.Identity.Name, Message = message }; this.repos.Reviews.AddReviewComment(reviewId, comment); return Json(new CommentViewModel(comment, this.repos.Profiles.Single(p => p.UserName == comment.UserName))); }