Exemple #1
0
 public async Task <IList <AgendaSalaModel> > GetAgendaSala()
 {
     try
     {
         var salaManager = (await _agendaSalaProvider.GetAgendaSala());
         return(salaManager);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
        public async Task <IList <AgendaSalaModel> > GetAgendaSala()
        {
            var response = await _agendaSalaProvider.GetAgendaSala();

            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 <AgendaSalaModel> >(jsonArray.ToString().TrimStart('{').TrimEnd('}'))));
        }