public static ContactDto MapToDto(Contact contact) { return(new ContactDto() { Contact1 = contact.Contact1, CreatedByUserId = contact.CreatedByUserId, CreatedDate = contact.CreatedDate, AddressId = contact.AddressId, Address = contact.Address != null?AddressRepository.MapToDto(contact.Address) : null, FirsttName = contact.FirsttName, IsDeleted = contact.IsDeleted, LastName = contact.LastName, ModifiedDate = contact.ModifiedDate, Phones = MapToPhonesDto(contact.Phone), Emails = MapToEmailsDto(contact.Email), }); }
public static Contact MapToDbEntity(ContactDto contactDto) { return(new Contact() { Contact1 = contactDto.Contact1, CreatedByUserId = contactDto.CreatedByUserId, CreatedDate = contactDto.CreatedDate, AddressId = contactDto.AddressId, Address = contactDto.Address != null?AddressRepository.MapToDbEntity(contactDto.Address) : null, FirsttName = contactDto.FirsttName, IsDeleted = contactDto.IsDeleted, LastName = contactDto.LastName, ModifiedDate = contactDto.ModifiedDate, Phone = MapToPhonesDbEntity(contactDto.Phones), Email = MapToEmailsDbEntity(contactDto.Emails) }); }