コード例 #1
0
        public async Task <bool> DeleteAsync(string tipo, int id)
        {
            WebServiceUrl = UServices.getUrl(tipo);

            Log.Info(TAG, "El Id del " + tipo + " a eliminar es: \n");
            Log.Info(TAG, id.ToString());

            var httpClient = new HttpClient();

            var response = await httpClient.DeleteAsync(WebServiceUrl + id);

            return(response.IsSuccessStatusCode);
        }
コード例 #2
0
        public async Task <List <T> > GetAsync(string tipo)
        {
            WebServiceUrl = UServices.getUrl(tipo);

            var httpClient = new HttpClient();

            var json = await httpClient.GetStringAsync(WebServiceUrl);

            Log.Info(TAG, "La data recibida en JSON es: \n");
            Log.Info(TAG, json);

            var taskModel = JsonConvert.DeserializeObject <List <T> >(json);

            return(taskModel);
        }
コード例 #3
0
        public async Task <List <T> > GetCheckListSummariesByBrowser(string tipo, string dato)
        {
            WebServiceUrl = UServices.getUrl(tipo);

            var httpClient = new HttpClient();

            var json = await httpClient.GetStringAsync(WebServiceUrl + "GetCheckListSummariesByBrowser/" + dato);

            Log.Info(TAG, "Los preusos del día en JSON son: \n");
            Log.Info(TAG, json);

            var taskModel = JsonConvert.DeserializeObject <List <T> >(json);

            return(taskModel);
        }
コード例 #4
0
        public async Task <T> GetDocumentsByPlate(string tipo, string placa)
        {
            WebServiceUrl = UServices.getUrl(tipo);

            var httpClient = new HttpClient();

            var json = await httpClient.GetStringAsync(WebServiceUrl + "GetDocumentsByPlate/" + placa);

            Log.Info(TAG, "Los documentos del Vehiculo en JSON es: \n");
            Log.Info(TAG, json);

            var taskModel = JsonConvert.DeserializeObject <T>(json);

            return(taskModel);
        }
コード例 #5
0
        public async Task <T> GetUserByAccount(string tipo, string account)
        {
            WebServiceUrl = UServices.getUrl(tipo);

            var httpClient = new HttpClient();

            var json = await httpClient.GetStringAsync(WebServiceUrl + "GetUserByAccount/" + account);

            Log.Info(TAG, "El usuario recibido en JSON es: \n");
            Log.Info(TAG, json);

            var taskModel = JsonConvert.DeserializeObject <T>(json);

            return(taskModel);
        }
コード例 #6
0
        public async Task <T> GetAsyncById(string tipo, int id)
        {
            WebServiceUrl = UServices.getUrl(tipo);

            Log.Info(TAG, "El Id del " + tipo + " a obtener es: \n");
            Log.Info(TAG, id.ToString());

            var httpClient = new HttpClient();

            var json = await httpClient.GetStringAsync(WebServiceUrl + id);

            Log.Info(TAG, "La data recibida en JSON es: \n");
            Log.Info(TAG, json);

            var taskModel = JsonConvert.DeserializeObject <T>(json);

            return(taskModel);
        }
コード例 #7
0
        public async Task <bool> PutAsync(string tipo, int id, T t)
        {
            WebServiceUrl = UServices.getUrl(tipo);

            var httpClient = new HttpClient();

            var json = JsonConvert.SerializeObject(t);

            Log.Info(TAG, "La data a actualizar en JSON es: \n");
            Log.Info(TAG, json);

            HttpContent httpContent = new StringContent(json);

            httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");

            var result = await httpClient.PutAsync(WebServiceUrl + id, httpContent);

            Log.Info(TAG, "La respuesta es: \n");
            Log.Info(TAG, result.ToString());

            return(result.IsSuccessStatusCode);
        }