Esempio n. 1
0
        public IEnumerable <ProfileDataModel> GetProfilesForUser(string userId)
        {
            object sqlParams = new { @userId = userId };

            IEnumerable <ProfileDataModel> data = _dataAccess.LoadData <ProfileDataModel>(DboNames.spGetProfilesByUser, DboNames.dboNameAzure, sqlParams);

            // Decrypt and reassign profile passwords
            foreach (var profile in data)
            {
                profile.Password = ProfileEncrypter.DecryptPassword(profile.Password, profile.UserId);
            }

            return(data);
        }
Esempio n. 2
0
        public void InsertProfileForUser(ProfileDataModel data)
        {
            data.Password = ProfileEncrypter.EncryptPassword(data.Password, data.UserId);

            object sqlParams = new
            {
                @userId      = data.UserId,
                @categoryId  = data.CategoryId,
                @title       = data.Title,
                @website     = data.Website,
                @loginName   = data.LoginName,
                @password    = data.Password,
                @signUpEmail = data.SignUpEmail
            };

            _dataAccess.SaveData(DboNames.spInsertProfileByUser, DboNames.dboNameAzure, sqlParams);
        }
Esempio n. 3
0
        public void UpdateProfile(ProfileDataModel data)
        {
            data.Password = ProfileEncrypter.EncryptPassword(data.Password, data.UserId);

            object sqlParams = new
            {
                @id          = data.Id,
                @categoryId  = data.CategoryId,
                @title       = data.Title,
                @website     = data.Website,
                @loginName   = data.LoginName,
                @password    = data.Password,
                @signUpEmail = data.SignUpEmail,
                @lastUpdated = data.LastUpdated
            };

            _dataAccess.SaveData(DboNames.spUpdateProfile, DboNames.dboNameAzure, sqlParams);
        }