public static string FormatAuthor(this HtmlHelper helper, UserComment comment) { if (!String.IsNullOrEmpty(comment.Url) && Uri.IsWellFormedUriString(comment.Url, UriKind.Absolute)) { Uri uri = new Uri(comment.Url); return String.Format("<a href=\"{0}\">{1}</a>", uri.ToString(), comment.Author); } return comment.Author; }
public ActionResult Comment(UserComment userComment) { userComment.UserCommentId = Guid.NewGuid(); userComment.PostedDate = DateTime.Now; using (IDataRepository<UserComment> repository = new DataRepository<UserComment>()) { repository.Create(userComment); repository.SaveChanges(); } return RedirectToAction("Details", new { id = userComment.BlogPostId }); }
/// <summary> /// Deprecated Method for adding a new object to the UserComments EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToUserComments(UserComment userComment) { base.AddObject("UserComments", userComment); }
/// <summary> /// Create a new UserComment object. /// </summary> /// <param name="userCommentId">Initial value of the UserCommentId property.</param> /// <param name="emailAddress">Initial value of the EmailAddress property.</param> public static UserComment CreateUserComment(global::System.Guid userCommentId, global::System.String emailAddress) { UserComment userComment = new UserComment(); userComment.UserCommentId = userCommentId; userComment.EmailAddress = emailAddress; return userComment; }