예제 #1
0
        public async Task PatchUser(string id, AzureUser user)
        {
            var userToUpdate = user.Adapt <AzureUserToPatch>();
            var content      = new StringContent(JsonConvert.SerializeObject(userToUpdate), Encoding.UTF8, "application/json");
            var response     = await SendRequest(HttpMethod.Patch, Consts.GraphApi.UserEntity, content, id);

            if (!response.IsSuccessStatusCode)
            {
                throw new ApplicationException("Can not update user with current parameters");
            }
        }
예제 #2
0
        public void UpdateUserInCache(AzureUser model)
        {
            var usersInCache = _cache.Get <List <AzureUser> >(Consts.Cache.UsersKey);
            var user         = usersInCache.FirstOrDefault(x => x.ObjectId == model.ObjectId);

            if (user != null)
            {
                MergeObjects(model, user);
            }
            else
            {
                usersInCache.Add(model.Adapt <AzureUser>());
            }
            _cache.Set(Consts.Cache.UsersKey, usersInCache);
        }