Пример #1
0
        public bool Create(Reservation model, string token)
        {
            var response = ApiHelpers
                           .DoPost(Api.Reservations.Create, model, token);

            return(response.IsSuccessStatusCode);
        }
        public string Login(string email, string password)
        {
            var credentials = Convert.ToBase64String(
                Encoding.UTF8.GetBytes($"{email}:{password}"));
            var authenticationHeader = new AuthenticationHeaderValue("Basic", credentials);
            var response             = ApiHelpers.DoPost(
                Constants.Api.Authentication.Authenticate,
                null,
                authenticationHeader);
            var message = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();

            return(JsonSerializer.Deserialize <TokenResponse>(message).Token);
        }
        public bool Register(Account account)
        {
            var response = ApiHelpers.DoPost(Constants.Api.Accounts.Create, account);

            return(response.IsSuccessStatusCode);
        }
Пример #4
0
        public bool Create(Trip model, string token)
        {
            var response = ApiHelpers.DoPost(Constants.Api.Trips.Create, model, token);

            return(response.IsSuccessStatusCode);
        }
Пример #5
0
 public bool Create(Review review, string token)
 {
     return(ApiHelpers.DoPost(Api.Reviews.Create, review, token).IsSuccessStatusCode);
 }