Ejemplo n.º 1
0
        public async Task <bool> Update(Models.SolicitudCupo model)
        {
            try
            {
                var    data    = JsonConvert.SerializeObject(model);
                var    content = new StringContent(data, Encoding.UTF8, "application/json");
                string path    = Commons.Constants.url;
                path += $"SolicitudCupos/{model.Id}";
                HttpResponseMessage response = await client.PutAsync(path, content);

                return(response.IsSuccessStatusCode);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        public async Task <Models.SolicitudCupo> SearchById(Guid id)
        {
            try
            {
                Models.SolicitudCupo cupo = new Models.SolicitudCupo();
                string path = Commons.Constants.url;
                path += $"SolicitudCupos/{id}";
                HttpResponseMessage response = await client.GetAsync(path);

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

                    cupo = JsonConvert.DeserializeObject <Models.SolicitudCupo>(objectString);
                }

                return(cupo);
            }
            catch (Exception ex)
            {
                throw;
            }
        }