private Runner CreateRunner(RunnerSignUpCredentials credentials) { return(new Runner { UserId = credentials.UserId, GenderId = credentials.GenderId, DateOfBirth = credentials.DateOfBirth, CountryId = credentials.CountryId, Photo = credentials.Photo }); }
public async Task <int> SignUpAsync(RunnerSignUpCredentials credentials) { if (IsUserRunner(credentials.UserId).Result) { throw new Exception($"User with id {credentials.UserId} is already signed up as runner"); } var newRunner = CreateRunner(credentials); int id = 0; await SaveRunner(newRunner).ContinueWith(r => id = newRunner.Id); return(id); }
public async Task <IActionResult> SignUp([FromBody] RunnerSignUpCredentials credentials) { if (credentials == null) { return(BadRequest()); } try { int runnerId = await _runnerService.SignUpAsync(credentials); return(Ok(runnerId)); } catch (Exception e) { return(BadRequest(e)); } }
public Task <int> SignUpAsync(RunnerSignUpCredentials credentials) { var uri = UriHelper.CombineUri(GlobalSettings.Instance.RunnerSignUp); return(_requestProvider.PostAsync <RunnerSignUpCredentials, int>(uri, credentials, this.GetToken())); }