Пример #1
0
 public static AuthData GenerateCredentials(AuthRegisterData data)
 {
     return(new AuthData
     {
         Email = data.Email,
         Password = data.Password
     });
 }
Пример #2
0
        public static async Task <AuthRegisteredData> RegisterUser(HttpClient client, AuthRegisterData user, bool isLocal = false)
        {
            string url;

            if (isLocal)
            {
                url = "/api/authentication/register";
            }
            else
            {
                url = "https://authentication-service.api.converge-app.net/api/authentication/register";
            }

            var response = await client.PostAsJsonAsync(url, user);

            if (response.IsSuccessStatusCode)
            {
                return(await response.Content.ReadAsAsync <AuthRegisteredData>());
            }
            else
            {
                throw new Exception("Was unsuccessful");
            }
        }