private Member(string firstName, string lastName, Address address, MembershipLevelEnum membershipLevelEnum, MembershipLevel membershipLevel) { FirstName = firstName; LastName = lastName; Address = address; RegistrationDate = DateTime.Now; MembershipLevelId = membershipLevelEnum; MembershipLevel = membershipLevel; }
public static Member CreateMember(string firstName, string lastName, Address address, MembershipLevelEnum membershipLevelEnum, MembershipLevel membershipLevel) { if (string.IsNullOrWhiteSpace(firstName) || string.IsNullOrWhiteSpace(lastName) || address == null || membershipLevel == null) { return(null); } return(new Member(firstName, lastName, address, membershipLevelEnum, membershipLevel)); }
public static Member CreateMember(string firstName, string lastName, Address address, MembershipLevelEnum membershipLevelEnum, MembershipLevel membershipLevel) { //Throw validation exception, not return null, make it explicit that the consumer has made an error if (string.IsNullOrWhiteSpace(firstName) || string.IsNullOrWhiteSpace(lastName) || address == null || membershipLevel == null) { return(null); } return(new Member(firstName, lastName, address, membershipLevelEnum, membershipLevel)); }