Ejemplo n.º 1
0
        public static coreModel.Contact ToCoreModel(this webModel.Contact contact)
        {
            var retVal = new coreModel.Contact();

            retVal.InjectFrom(contact);


            if (contact.Phones != null)
            {
                retVal.Phones = contact.Phones;
            }
            if (contact.Emails != null)
            {
                retVal.Emails = contact.Emails;
            }
            if (contact.DynamicProperties != null)
            {
                retVal.DynamicProperties = contact.DynamicProperties;
            }
            if (contact.Notes != null)
            {
                retVal.Notes = contact.Notes.Select(x => x.ToCoreModel()).ToList();
            }
            if (contact.Addresses != null)
            {
                retVal.Addresses = contact.Addresses.Select(x => x.ToCoreModel()).ToList();
            }
            if (contact.SecurityAccounts != null)
            {
                retVal.SecurityAccounts = contact.SecurityAccounts;
            }
            retVal.Organizations = contact.Organizations;

            return(retVal);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Converting to model type
        /// </summary>
        /// <param name="dbEntity"></param>
        /// <returns></returns>
        public static coreModel.Contact ToCoreModel(this dataModel.Contact dbEntity)
        {
            if (dbEntity == null)
                throw new ArgumentNullException("dbEntity");

            var retVal = new coreModel.Contact();
            retVal.InjectFrom(dbEntity);

            retVal.Addresses = dbEntity.Addresses.Select(x => x.ToCoreModel()).ToList();
            retVal.Emails = dbEntity.Emails.Select(x => x.Address).ToList();
            retVal.Notes = dbEntity.Notes.Select(x => x.ToCoreModel()).ToList();
            retVal.Phones = dbEntity.Phones.Select(x => x.Number).ToList();
            retVal.Organizations = dbEntity.MemberRelations.Select(x => x.Ancestor).OfType<dataModel.Organization>().Select(x => x.Id).ToList();
            return retVal;

        }
Ejemplo n.º 3
0
        /// <summary>
        /// Converting to model type
        /// </summary>
        /// <param name="dbEntity"></param>
        /// <returns></returns>
        public static coreModel.Contact ToCoreModel(this dataModel.Contact dbEntity)
        {
            if (dbEntity == null)
            {
                throw new ArgumentNullException("dbEntity");
            }

            var retVal = new coreModel.Contact();

            retVal.InjectFrom(dbEntity);

            retVal.Addresses     = dbEntity.Addresses.OrderBy(x => x.Id).Select(x => x.ToCoreModel()).ToList();
            retVal.Emails        = dbEntity.Emails.OrderBy(x => x.Id).Select(x => x.Address).ToList();
            retVal.Notes         = dbEntity.Notes.OrderBy(x => x.Id).Select(x => x.ToCoreModel()).ToList();
            retVal.Phones        = dbEntity.Phones.OrderBy(x => x.Id).Select(x => x.Number).ToList();
            retVal.Organizations = dbEntity.MemberRelations.Select(x => x.Ancestor).OfType <dataModel.Organization>().Select(x => x.Id).ToList();
            return(retVal);
        }
Ejemplo n.º 4
0
        public static coreModel.Contact ToCoreModel(this webModel.Contact contact)
        {
            var retVal = new coreModel.Contact();
            retVal.InjectFrom(contact);


            if (contact.Phones != null)
                retVal.Phones = contact.Phones;
            if (contact.Emails != null)
                retVal.Emails = contact.Emails;
			if (contact.DynamicProperties != null)
				retVal.DynamicProperties = contact.DynamicProperties;
            if (contact.Notes != null)
                retVal.Notes = contact.Notes.Select(x => x.ToCoreModel()).ToList();
            if (contact.Addresses != null)
                retVal.Addresses = contact.Addresses.Select(x => x.ToCoreModel()).ToList();
            retVal.Organizations = contact.Organizations;

            return retVal;
        }