public async Task <bool> RegisterUser(string username, string password) { var param = new UserRegistrationRM(username, password); var responseDto = await _sgService .RegisterUser(Priority.UserInitiated, param) .ConfigureAwait(false); if (responseDto != null) { return(true); } return(false); }
public async Task <HttpResponseMessage> RegisterUser(Priority priority, UserRegistrationRM param) { HttpResponseMessage response = null; Task <HttpResponseMessage> task; switch (priority) { case Priority.Background: task = _apiService.Background.RegisterUser(param); break; case Priority.UserInitiated: task = _apiService.UserInitiated.RegisterUser(param); break; case Priority.Speculative: task = _apiService.Speculative.RegisterUser(param); break; default: task = _apiService.UserInitiated.RegisterUser(param); break; } if (CrossConnectivity.Current.IsConnected) { response = await Policy .Handle <Exception>() .WaitAndRetryAsync ( retryCount: 3, sleepDurationProvider: retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)) ) .ExecuteAsync(async() => await task); } return(response); }