예제 #1
0
        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;
        }
예제 #2
0
        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 });
        }
예제 #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the UserComments EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUserComments(UserComment userComment)
 {
     base.AddObject("UserComments", userComment);
 }
예제 #4
0
 /// <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;
 }