Пример #1
0
        /// <summary>
        /// Add new profile
        /// </summary>
        /// <param name="profileDTO"></param>
        public void SaveProfileInformation(ProfileDTO profileDTO)
        {
            if (profileDTO == null)
            {
                throw new ArgumentException(Messages.warning_CannotAddProfileWithNullInformation);
            }

            var newProfile = ProfileFactory.CreateProfile(profileDTO.FirstName, profileDTO.LastName, profileDTO.Email, "Anand", DateTime.Now, "Anand", DateTime.Now);

            newProfile = SaveProfile(newProfile);

            if (profileDTO.AddressDTO != null && profileDTO.AddressDTO.Any())
            {
                foreach (AddressDTO address in profileDTO.AddressDTO)
                {
                    this.SaveAddress(address, newProfile);
                }
            }

            if (profileDTO.PhoneDTO != null && profileDTO.PhoneDTO.Any())
            {
                foreach (PhoneDTO phone in profileDTO.PhoneDTO)
                {
                    this.SavePhone(phone, newProfile);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Add new profile
        /// </summary>
        /// <param name="profileDTO"></param>
        /// <returns></returns>
        public void SaveProfileInformation(ProfileDTO profileDTO)
        {
            //if profileDTO data is not valid
            if (profileDTO == null)
            {
                throw new ArgumentException(Messages.warning_CannotAddProfileWithNullInformation);
            }

            //Create a new profile entity
            var newProfile = ProfileFactory.CreateProfile(profileDTO.FirstName, profileDTO.LastName, profileDTO.Email, "Anand", DateTime.Now, "Anand", DateTime.Now);

            //Save Profile
            newProfile = SaveProfile(newProfile);

            //if profileDTO contains any address
            if (profileDTO.AddressDTO != null)
            {
                foreach (AddressDTO objAddressDTO in profileDTO.AddressDTO)
                {
                    this.SaveAddress(objAddressDTO, newProfile);
                }
            }

            //if profileDTO contains any phone
            if (profileDTO.PhoneDTO != null)
            {
                foreach (PhoneDTO objPhoneDTO in profileDTO.PhoneDTO)
                {
                    this.SavePhone(objPhoneDTO, newProfile);
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Add new profile
        /// </summary>
        /// <param name="profileDTO"></param>
        /// <returns></returns>
        public void SaveProfileInformation(ProfileDTO profileDTO)
        {
            //if profileDTO data is not valid
            if (profileDTO == null)
            {
                throw new ArgumentException(Messages.warning_CannotAddProfileWithNullInformation);
            }

            //Create a new profile entity
            var newProfile = ProfileFactory.CreateProfile(profileDTO.FirstName, profileDTO.LastName, profileDTO.Email, profileDTO.Status, "Namdeo Jadhav", DateTime.Now, "Namdeo Jadhav", DateTime.Now);

            //Save Profile
            newProfile = SaveProfile(newProfile);
        }