I wanna (want to) capture the event when the user adds a new state to the country.
I will apply some business rules to this new State before inserting into the database.
namespace ClassLibrary1
{
public class Country
{
public Country()
{
States = new HashSet<State>();
}
public virtual ICollection<State> States { get; set; }
}
public class State {
public string Code { get; set; }
public string Name { get; set; }
}
public class test {
public test()
{
Country c = new Country();
//I wanna (want to) capture this action inside of the class "Country"
c.States.Add(new State { Code = "US", Name = "Unated States" });
}
}
}
Thank you everyone