Skip to content

Instantly share code, notes, and snippets.

@gavilanch
Created December 3, 2019 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gavilanch/2034db92821b5e437575b34a41e49149 to your computer and use it in GitHub Desktop.
Save gavilanch/2034db92821b5e437575b34a41e49149 to your computer and use it in GitHub Desktop.
public class Country
{
public int Id { get; set; }
public string Name { get; set; }
public List<State> States { get; set; }
}
public class State
{
public int Id { get; set; }
public string Name { get; set; }
public int CountryId { get; set; }
public Country Country { get; set; }
}
public class Person
{
public int Id { get; set; }
[Required]
public string Name { get; set; }
public string Biography { get; set; }
[Range(1, int.MaxValue, ErrorMessage = "You must select a state")]
public int StateId { get; set; }
public State State { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment