aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio_v2/Tango.BLL/Mappers/OrganizationToOrganizationEntityMapper.cs
blob: 0d6079f1fee9b0d6c580a1f2bc3884796568b942 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.Text;
using Tango.BLL.Objects;
using Tango.DAL.Entities;

namespace Tango.BLL.Mappers
{
    public class OrganizationToOrganizationEntityMapper : IMapper<Organization, OrganizationEntity>
    {
        public void Map(Organization source, OrganizationEntity target)
        {
            target.ID = source.ID;
            target.Name = source.Name;
            new AddressToAddressModelMapper().Map(source.Address, target.Address);
            new ContactToContactModelMapper().Map(source.Contact, target.Contact);
        }

        public void Map(OrganizationEntity source, Organization target)
        {
            target.ID = source.ID;
            target.Name = source.Name;
            new AddressToAddressModelMapper().Map(source.Address, target.Address);
            new ContactToContactModelMapper().Map(source.Contact, target.Contact);
        }

        public OrganizationEntity Create(Organization source)
        {
            OrganizationEntity entity = new OrganizationEntity();
            Map(source, entity);
            return entity;
        }

        public Organization Create(OrganizationEntity source)
        {
            Organization organization = new Organization();
            Map(source, organization);
            return organization;
        }
    }
}