public async Task <List <UserProfileProperty> > Put([FromBody] List <UserProfileProperty> userProfileProperties)
        {
            CheckNullBody(userProfileProperties);

            if (!IsAdmin && userProfileProperties.Any(c => c.UserId != UserId))
            {
                throw new CallerException("Users cannot update other Users profiles.");
            }

            var userProfileUpdater = new UserProfileUpdater(Cache, BudgeterLock, Context);

            return(await userProfileUpdater.UpdateUserProfileProperties(userProfileProperties, IsAdmin));
        }
Пример #2
0
        public async Task AddGoogleIdToProfileProperty(UserSearchResponse user, string googleId, bool isAdmin)
        {
            List <UserProfileProperty> googleIdPP = new List <UserProfileProperty>
            {
                new UserProfileProperty
                {
                    UserId = user.UserId,
                    Value  = googleId,
                    ProfilePropertyName = "GoogleId"
                }
            };

            UserProfileUpdater userProfileUpdater = new UserProfileUpdater(Cache, BudgeterLock, UserContext);

            await userProfileUpdater.UpdateUserProfileProperties(googleIdPP, isAdmin);
        }