public Task <HttpResponseMessage> CreateAnswer(Riddle riddle)
        {
            Answer answer = new Answer
            {
                Riddle = riddle.Id,
                Solver = _settings.GetItem(SettingTypes.UserId)
            };

            return(_baseApiAccessor.PostJson(_apiConnection, answer));
        }
        public async Task <HttpResponseMessage> Authenticate(User user)
        {
            var response = await _baseApiAccessor.PostJson(_apiConnection, user);

            if (response.IsSuccessStatusCode)
            {
                var authJson = await response.Content.ReadAsStringAsync();

                AuthResponse authResponse = JsonConvert.DeserializeObject <AuthResponse>(authJson);

                _settings.SetItem(SettingTypes.Jwt, authResponse.Token);
                _settings.SetItem(SettingTypes.UserId, authResponse.User.Id);
            }

            return(response);
        }
 public Task <HttpResponseMessage> CreateRiddle(Riddle riddle)
 {
     return(_baseApiAccessor.PostJson(_apiConnection, riddle));
 }
Ejemplo n.º 4
0
 public Task <HttpResponseMessage> SignUp(User user)
 {
     return(_baseApiAccessor.PostJson(_apiConnection, user));
 }