diff options
Diffstat (limited to 'src/DevHive.Web/Models/Post')
4 files changed, 44 insertions, 7 deletions
diff --git a/src/DevHive.Web/Models/Post/Comment/CommentWebModel.cs b/src/DevHive.Web/Models/Post/Comment/CommentWebModel.cs index 3cdc7c4..590851d 100644 --- a/src/DevHive.Web/Models/Post/Comment/CommentWebModel.cs +++ b/src/DevHive.Web/Models/Post/Comment/CommentWebModel.cs @@ -1,11 +1,25 @@ using System; +using System.ComponentModel.DataAnnotations; +using System.Diagnostics.CodeAnalysis; namespace DevHive.Web.Models.Post.Comment { public class CommentWebModel { + [NotNull] + [Required] public Guid IssuerId { get; set; } + + [NotNull] + [Required] + public Guid PostId { get; set; } + + [NotNull] + [Required] public string Message { get; set; } + + [NotNull] + [Required] public DateTime TimeCreated { get; set; } } -}
\ No newline at end of file +} diff --git a/src/DevHive.Web/Models/Post/Post/BasePostWebModel.cs b/src/DevHive.Web/Models/Post/Post/BasePostWebModel.cs index caa9925..35ddd34 100644 --- a/src/DevHive.Web/Models/Post/Post/BasePostWebModel.cs +++ b/src/DevHive.Web/Models/Post/Post/BasePostWebModel.cs @@ -1,10 +1,17 @@ using System; +using System.ComponentModel.DataAnnotations; +using System.Diagnostics.CodeAnalysis; namespace DevHive.Web.Models.Post.Post { public class BasePostWebModel { + [NotNull] + [Required] public Guid IssuerId { get; set; } + + [NotNull] + [Required] public string Message { get; set; } } -}
\ No newline at end of file +} diff --git a/src/DevHive.Web/Models/Post/Post/CreatePostWebModel.cs b/src/DevHive.Web/Models/Post/Post/CreatePostWebModel.cs index 7558b2c..389ff9e 100644 --- a/src/DevHive.Web/Models/Post/Post/CreatePostWebModel.cs +++ b/src/DevHive.Web/Models/Post/Post/CreatePostWebModel.cs @@ -2,7 +2,5 @@ using System; namespace DevHive.Web.Models.Post.Post { - public class CreatePostWebModel : BasePostWebModel - { - } -}
\ No newline at end of file + public class CreatePostWebModel : BasePostWebModel { } +} diff --git a/src/DevHive.Web/Models/Post/Post/PostWebModel.cs b/src/DevHive.Web/Models/Post/Post/PostWebModel.cs index fa18c3a..fe35cee 100644 --- a/src/DevHive.Web/Models/Post/Post/PostWebModel.cs +++ b/src/DevHive.Web/Models/Post/Post/PostWebModel.cs @@ -1,3 +1,6 @@ +using System.ComponentModel.DataAnnotations; +using System.Diagnostics.CodeAnalysis; +using DevHive.Web.Attributes; using DevHive.Web.Models.Post.Comment; namespace DevHive.Web.Models.Post.Post @@ -6,16 +9,31 @@ namespace DevHive.Web.Models.Post.Post { //public string Picture { get; set; } + [NotNull] + [Required] + [MinLength(3)] + [MaxLength(50)] public string IssuerFirstName { get; set; } + [NotNull] + [Required] + [MinLength(3)] + [MaxLength(50)] public string IssuerLastName { get; set; } + [NotNull] + [Required] + [MinLength(3)] + [MaxLength(50)] + [OnlyAlphanumerics(ErrorMessage = "Username can only contain letters and digits!")] public string IssuerUsername { get; set; } + [NotNull] + [Required] public string Message { get; set; } //public Files[] Files { get; set; } public CommentWebModel[] Comments { get; set; } } -}
\ No newline at end of file +} |
