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");
            }
        }
Exemple #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);
        }