예제 #1
0
        public async Task <List <Usuario> > GetAllAsync()
        {
            return(await RestClientService <List <Usuario> > .Get("users"));

            //List<Usuario> usuarios = null;
            //HttpResponseMessage response = await RESTClient.ApiClient.GetAsync("users");
            //if (response.IsSuccessStatusCode)
            //{
            //    usuarios = await response.Content.ReadAsAsync<List<Usuario>>();
            //    return usuarios;
            //}
            //else
            //{
            //    throw new Exception(response.ReasonPhrase);
            //}
        }
예제 #2
0
        public async Task <string> Insert(Usuario userInsert, Usuario user)
        {
            return(await RestClientService <Usuario> .Post("users", userInsert));

            //HttpResponseMessage response = await RESTClient.ApiClient.PostAsJsonAsync("users",userInsert);
            ////response.EnsureSuccessStatusCode();

            //if (response.IsSuccessStatusCode)
            //{
            //    response.EnsureSuccessStatusCode();
            //    var newUserUrl = response.Headers.Location;
            //    //Ther user can be consume using newUserUrl string
            //    return true;
            //}
            //else
            //{
            //    throw new Exception(response.ReasonPhrase);
            //}
        }
예제 #3
0
 public async Task <List <Cuenta> > GetAll(string companyId)
 => await RestClientService <List <Cuenta> > .Get($"accounts/{companyId}");