Skip to content

Instantly share code, notes, and snippets.

@codebeaulieu
Created May 20, 2015 22:32
Show Gist options
  • Save codebeaulieu/bb4d90e9f47b1c1d9b6b to your computer and use it in GitHub Desktop.
Save codebeaulieu/bb4d90e9f47b1c1d9b6b to your computer and use it in GitHub Desktop.
Post.cs | Stack Overflow | How to resolve ModelState.IsValid = false while binding a List type?
public class Post : IEntity
{
[Key]
public int Id { get; set; }
[Required]
public string Title { get; set; }
public string URL { get; set; }
[Required]
public string IntroText { get; set; }
[Required]
public string Body { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
[Column(TypeName = "DateTime")]
public DateTime Created { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
[Column(TypeName = "DateTime")]
public DateTime? Modified { get; set; }
[Required]
public string Author { get; set; }
public List<Comment> Comments { get; set; }
public List<Tag> Tags { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment