Beispiel #1
0
 public async Task <IList <Sala> > GetSalas()
 {
     try
     {
         var salaManager = (await _salaProvider.GetSalas());
         return(salaManager);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #2
0
        public async Task <IList <SalaModel> > GetSalas()
        {
            var response = await _salaProvider.GetSalas();

            if (!response.IsSuccessStatusCode)
            {
                await ErrorResponse(response, "Get");
            }

            var json = await response.Content.ReadAsStringAsync();

            JArray jsonArray = JArray.Parse(await response.Content.ReadAsStringAsync());

            return(await Task.Factory.StartNew(() => JsonConvert.DeserializeObject <IList <SalaModel> >(jsonArray.ToString().TrimStart('{').TrimEnd('}'))));
        }