Пример #1
0
        public async Task <Result> CreateUserAsync(RegisterModel registerModel)
        {
            try
            {
                var registerAsJson = JsonConvert.SerializeObject(registerModel);

                var response = await httpClient.PostAsync("api/v1/OAuth/Register",
                                                          new StringContent(registerAsJson, Encoding.UTF8, "application/json"));

                var result = JsonConvert.DeserializeObject <Result>(await response.Content.ReadAsStringAsync());

                if (result.Succeeded)
                {
                    await _currentUser.SetEmail(registerModel.Email);
                }

                return(result);
            }
            catch (Exception ex)
            {
                return(CommonResults.InternalServerError("Internal Server Error", "سرور در حال بارگذاری می باشد"));
            }
        }