Exemple #1
0
 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;
 }
Exemple #2
0
        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));
        }
Exemple #3
0
        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));
        }