Example #1
0
        /// <summary>
        /// Update information about the user.
        /// </summary>
        /// <returns>Token string if success, string.Empty otherwise.</returns>
        public async Task <bool> UpdateUserAsync(UserModel user)
        {
            if (user == null)
            {
                return(false);
            }

            UserModelWithToken tokenedModel = user.ToTokenedModel(Token);

            return(await ApiService.UpdateUserAsync(tokenedModel));
        }
Example #2
0
        public async Task <bool> UpdateUserAsync(UserModelWithToken user)
        {
            var json    = JsonConvert.SerializeObject(user);
            var content = new StringContent(json, Encoding.UTF8, "application/json");
            var uri     = new Uri(Constants.UserUpdateUrl);

            try
            {
                using (var client = NewHttpClient())
                {
                    HttpResponseMessage response = await client.PutAsync(uri, content);

                    return(response.IsSuccessStatusCode);
                }
            }
            catch (Exception)
            {
                // ignored
            }

            return(false);
        }