Skip to content

[ENH] Expand Person model #272

Description

@SteveTeece

Expand the current Person model to include additional fields and multiple addresses. Move age calculations into the person model.

New models:
Person Model

 public partial class Person
    {
        // Private member variables
        private string _fullname;
        
        // Public properties
        public int PersonId { get; private set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string FullName
        {
            get
            {
                _fullname = FirstName + " " + LastName;
                return _fullname;
            }
        }
        public List<Address> Addresses { get; set; }
        public DateTime DateOfBirth { get; set; }
        public string EmailAddress { get; set; }
        public string HomePhone { get; set; }
        public string Mobile { get; set; }
        public byte[] Photo { get; set; }
    }

Address Model:

 public abstract class Address
    {
        /*
         * This class defines an address.  
         * The purpose of this class is to create a custom data type that can be used in other classes
         * where an address is needed.
         * 
         * Create a public property with type Address to use this class.
         */

        // Private member variables

        // Public Properties
        public string UnitNumber { get; set; }
        public string BuildingName { get; set; }
        public string StreetNumber { get; set; }
        public string StreetName { get; set; }
        public string City { get; set; }
        public string State { get; set; }
        public string Postcode { get; set; }
        public string Country { get; set; }
       public AddressType {get; set;}
        public string AddressLine
        {
            get
            {
                return string.Format("{0} {1}, {2}, {3}, {4}, {5}", StreetNumber, StreetName, City, State, Postcode, Country);
            }
        }

    }

Addresstype Enum:

public enum AddressType
 }
       Residential,
       Work,
       Other
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions