Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.ComponentModel.DataAnnotations;
- using System.Web;
- namespace SmartBlogLibraries.Models
- {
- /// <summary>
- /// The model to be used when adding a comment form to SmartBlog.
- /// </summary>
- public class SmartBlogCommentFormModel
- {
- /// <summary>
- /// Name of the person who made the comment.
- /// </summary>
- [Required(ErrorMessage = "Name is required")]
- [RegularExpression(@"^((?!Name).)*$", ErrorMessage = "Name is required")]
- [DataType(DataType.Text)]
- [Display(Name = "Name")]
- public String Name { get; set; }
- /// <summary>
- /// Email of the person who made the comment.
- /// </summary>
- [Required(ErrorMessage = "Email is required")]
- [RegularExpression(@"^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$", ErrorMessage = "Invalid Email Address")]
- [DataType(DataType.Text)]
- [Display(Name = "Email")]
- public String Email { get; set; }
- /// <summary>
- /// Website of the person who made the comment.
- /// </summary>
- [DataType(DataType.Text)]
- [Display(Name = "Website")]
- public String Website { get; set; }
- /// <summary>
- /// Comment of the person who made the comment.
- /// </summary>
- [Required(ErrorMessage = "Comment is required")]
- [RegularExpression(@"^(((?!Your Comment).|(Your Comment.).|\n)*)$", ErrorMessage = "Comment is required")]
- [DataType(DataType.MultilineText)]
- [Display(Name = "Comment")]
- public String Comment { get; set; }
- /// <summary>
- /// The value that should be correct before the form is posted.
- /// </summary>
- [Required(ErrorMessage = "Security question is required")]
- [RegularExpression(@"^(4)*$", ErrorMessage = "Invalid security answer")]
- [DataType(DataType.Text)]
- [Display(Name = "Security Question")]
- public String SecurityQuestion { get; set; }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement