Example #1
0
 private Runner CreateRunner(RunnerSignUpCredentials credentials)
 {
     return(new Runner
     {
         UserId = credentials.UserId,
         GenderId = credentials.GenderId,
         DateOfBirth = credentials.DateOfBirth,
         CountryId = credentials.CountryId,
         Photo = credentials.Photo
     });
 }
Example #2
0
        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);
        }
Example #3
0
        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));
            }
        }
Example #4
0
        public Task <int> SignUpAsync(RunnerSignUpCredentials credentials)
        {
            var uri = UriHelper.CombineUri(GlobalSettings.Instance.RunnerSignUp);

            return(_requestProvider.PostAsync <RunnerSignUpCredentials, int>(uri, credentials, this.GetToken()));
        }