public UserDataModel Update(UserDataModel dataModel)
        {
            if (dataModel != null)
            {
                UserDTO        userDTO        = new UserDTO();
                UserAccountDTO userAccountDTO = new UserAccountDTO();
                PhoneDTO       phoneDTO       = new PhoneDTO();
                EmailDTO       emailDTO       = new EmailDTO();
                AddressDTO     addressDTO     = new AddressDTO();

                userDTO        = UserDataModelAssembler.ToUserDTO(dataModel);
                userAccountDTO = UserDataModelAssembler.ToUserAccountDTO(dataModel);
                phoneDTO       = UserDataModelAssembler.ToPhoneDTO(dataModel);
                emailDTO       = UserDataModelAssembler.ToEmailDTO(dataModel);
                addressDTO     = UserDataModelAssembler.ToAddressDTO(dataModel);

                if (userDTO != null)
                {
                    userDTO = usersBL.Update(userDTO);
                }
                if (userAccountDTO != null)
                {
                    userAccountDTO = AccountBL.Update(userAccountDTO);
                }
                if (phoneDTO != null)
                {
                    phoneDTO = phonesBL.Update(phoneDTO);
                }
                if (emailDTO != null)
                {
                    EmailsBL.Update(emailDTO);
                }
                if (addressDTO != null)
                {
                    AddressBL.Update(addressDTO);
                }
            }

            return(dataModel);
        }
Example #2
0
        public UserDataModel CreateUser(UserDataModel userDataModel)
        {
            if (userDataModel != null)
            {
                UserDTO        userDTO        = new UserDTO();
                UserAccountDTO userAccountDTO = new UserAccountDTO();
                PhoneDTO       oPhoneDTO      = new PhoneDTO();
                EmailDTO       oEmailDTO      = new EmailDTO();
                AddressDTO     oAddressDTO    = new AddressDTO();

                userDTO        = UserDataModelAssembler.ToUserDTO(userDataModel);
                userAccountDTO = UserDataModelAssembler.ToUserAccountDTO(userDataModel);
                oPhoneDTO      = UserDataModelAssembler.ToPhoneDTO(userDataModel);
                oEmailDTO      = UserDataModelAssembler.ToEmailDTO(userDataModel);
                oAddressDTO    = UserDataModelAssembler.ToAddressDTO(userDataModel);

                if (userDTO != null)
                {
                    userDTO = usersBL.Create(userDTO);
                }
                if (userAccountDTO != null)
                {
                    userAccountDTO = AccountBL.Create(userAccountDTO);
                }
                if (oPhoneDTO != null)
                {
                    oPhoneDTO = oPhonesBL.Create(oPhoneDTO);
                }
                if (oEmailDTO != null)
                {
                    oEmailsBL.Create(oEmailDTO);
                }
                if (oAddressDTO != null)
                {
                    oAddressBL.Create(oAddressDTO);
                }
            }

            return(userDataModel);
        }
        public UserDataModel Create(UserDataModel dataModel)
        {
            if (dataModel != null)
            {
                UserDTO        userDTO        = new UserDTO();
                UserAccountDTO userAccountDTO = new UserAccountDTO();
                PhoneDTO       phoneDTO       = new PhoneDTO();
                EmailDTO       emailDTO       = new EmailDTO();
                AddressDTO     addressDTO     = new AddressDTO();
                ExperienceDTO  exprienceDTO   = new ExperienceDTO();
                AchievementDTO achievementDTO = new AchievementDTO();
                EducationDTO   educationDTO   = new EducationDTO();
                SkillDTO       skillDTO       = new SkillDTO();
                LanguageDTO    language       = new LanguageDTO();

                userDTO        = UserDataModelAssembler.ToUserDTO(dataModel);
                userAccountDTO = UserDataModelAssembler.ToUserAccountDTO(dataModel);
                phoneDTO       = UserDataModelAssembler.ToPhoneDTO(dataModel);
                emailDTO       = UserDataModelAssembler.ToEmailDTO(dataModel);
                addressDTO     = UserDataModelAssembler.ToAddressDTO(dataModel);

                if (userDTO != null)
                {
                    userDTO = usersBL.Create(userDTO);
                }
                dataModel      = UserDataModelAssembler.ToDataModel(userDTO, userAccountDTO, addressDTO, phoneDTO, emailDTO, null, null, null, null, null, null);
                userAccountDTO = UserDataModelAssembler.ToUserAccountDTO(dataModel);
                if (userAccountDTO != null)
                {
                    userAccountDTO = AccountBL.Create(userAccountDTO);
                }
                addressDTO = UserDataModelAssembler.ToAddressDTO(dataModel);
                if (addressDTO != null)
                {
                    addressDTO = AddressBL.Create(addressDTO);
                }
                dataModel = UserDataModelAssembler.ToDataModel(userDTO, userAccountDTO, addressDTO, phoneDTO, emailDTO, null, null, null, null, null, null);
                new UserAddressBL().Create(new UserAddressDTO()
                {
                    UserID    = dataModel.UserID,
                    AddressID = dataModel.UserAddressID,
                    IsPrimary = true
                });
                dataModel = UserDataModelAssembler.ToDataModel(userDTO, userAccountDTO, addressDTO, phoneDTO, emailDTO, null, null, null, null, null, null);
                phoneDTO  = UserDataModelAssembler.ToPhoneDTO(dataModel);
                if (phoneDTO != null)
                {
                    phoneDTO.AddressbookID = addressDTO.AddressID;
                    phoneDTO = phonesBL.Create(phoneDTO);
                }
                dataModel = UserDataModelAssembler.ToDataModel(userDTO, userAccountDTO, addressDTO, phoneDTO, emailDTO, null, null, null, null, null, null);
                new UserPhoneBL().Create(new UserPhoneDTO()
                {
                    UserID    = dataModel.UserID,
                    PhoneID   = dataModel.UserPhoneID,
                    IsPrimary = true
                });
                emailDTO = UserDataModelAssembler.ToEmailDTO(dataModel);
                if (emailDTO != null)
                {
                    emailDTO = EmailsBL.Create(emailDTO);
                }
                dataModel = UserDataModelAssembler.ToDataModel(userDTO, userAccountDTO, addressDTO, phoneDTO, emailDTO, null, null, null, null, null, null);
                new UserEmailBL().Create(new UserEmailDTO()
                {
                    UserID    = dataModel.UserID,
                    EmailID   = dataModel.UserEmailID,
                    IsPrimary = true
                });
            }
            return(dataModel);
        }