Example #1
0
        // GET: Usuario
        public async Task <ActionResult> Index()
        {
            ApiCall api      = new ApiCall(Session);
            var     response = await api.GetAsync("/api/Usuario");

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

                var users = JsonConvert.DeserializeObject <List <User> >(datastring);
                return(View(users));
            }
            bitacora.AgregarBitacora("Usuario", "Index", "No se pudo obtener datos", Session["US"].ToString(), 2);
            return(View(new List <User>()));
        }
Example #2
0
        // GET: Mascota
        public async Task <ActionResult> Index()
        {
            ApiCall api      = new ApiCall(Session);
            var     response = await api.GetAsync("/api/Mascota");

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

                var mascotas = JsonConvert.DeserializeObject <List <Mascota> >(datastring).FindAll(c => c.Estado);
                return(View(mascotas));
            }
            bitacora.AgregarBitacora("Mascota", "Index", "No se pudo obtener datos", Session["US"].ToString(), 2);
            return(View(new List <Mascota>()));
        }