Contact.cs 854 Bytes
Newer Older
Andres Käver's avatar
initial  
Andres Käver committed
1
2
3
4
5
6
namespace Domain
{
    public class Contact
    {
        public string ContactValue { get; set; }

Nikita Kums's avatar
1    
Nikita Kums committed
7
        public Contact(string contactValue, Person person, ContactType contactType)
Andres Käver's avatar
initial  
Andres Käver committed
8
        {
Nikita Kums's avatar
1    
Nikita Kums committed
9
            ContactValue = contactValue;
Andres Käver's avatar
initial  
Andres Käver committed
10
11
            Person = person;
            ContactType = contactType;
Nikita Kums's avatar
Nikita Kums committed
12
13
14
15
16
            //when creating a new contact then we add the contact to person and
            //contactType aswell. so we can get to contact from person and from
            //contactType. Otherwise Contact has a person and a contactType
            //for the person but if coming from contactType or person side
            //then theres nothing.
Nikita Kums's avatar
1    
Nikita Kums committed
17
18
            person.Contacts.Add(this);
            contactType.Contacts.Add(this);
Andres Käver's avatar
initial  
Andres Käver committed
19
20
21
22
23
24
        }
        
        public Person Person { get; set; }
        public ContactType ContactType { get; set; }
    }
}