// GET: Usuarios/Delete/5
        public ActionResult Delete(int id)
        {
            Usuario_RolModel URol = null;

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(BaseURL);
                var responseTask = client.GetAsync("api/Usuario_Rol/" + id.ToString());
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <Usuario_RolModel>();
                    readTask.Wait();
                    URol = readTask.Result;
                }
            }
            return(View(URol));
        }
 public ActionResult Edit(Usuario_RolModel URol)
 {
     try
     {
         using (var client = new HttpClient())
         {
             var putTask = client.PutAsJsonAsync($"api/Usuario_Rol/{URol.Id}", URol);
             putTask.Wait();
             var result = putTask.Result;
             if (result.IsSuccessStatusCode)
             {
                 return(RedirectToAction("Index"));
             }
         }
         return(View(URol));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult Create(Usuario_RolModel URol)
 {
     try
     {
         using (var client = new HttpClient())
         {
             client.BaseAddress = new Uri(BaseURL + "api/Usuario_Rol");
             var postTask = client.PostAsJsonAsync <Usuario_RolModel>("Usuario_Rol", URol);
             postTask.Wait();
             var result = postTask.Result;
             if (result.IsSuccessStatusCode)
             {
                 return(RedirectToAction("Index"));
             }
         }
         ModelState.AddModelError(string.Empty, "Error");
         return(View(URol));
     }
     catch
     {
         return(View());
     }
 }
        public ActionResult Delete(int id, Usuario_RolModel URol)
        {
            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(BaseURL);
                    var deleteTask = client.GetAsync("api/Usuario_Rol/" + id.ToString());
                    deleteTask.Wait();

                    var result = deleteTask.Result;
                    if (result.IsSuccessStatusCode)
                    {
                        return(RedirectToAction("Index"));
                    }
                }
                return(View(URol));
            }
            catch
            {
                return(View());
            }
        }