public EmailAddress AddEmail(string value) { // email may already exist var email = Emails.ByValue(value); if (email != null) { return(email); } // create email email = new EmailAddress { // if person does not already have a default email, this is it IsDefault = (Emails.Count(a => a.IsDefault) == 0), Value = value, Person = this, Number = Emails.NextNumber(), }; // add & return email Emails.Add(email); return(email); }
public EmailAddress GetEmail(string value) { if (Emails == null || !Emails.Any()) { return(null); } return(Emails.ByValue(value)); }