public ActionResult Edit(RolesModel model, string submitButton)
 {
     if (Session["User"] != null)
     {
         if (ModelState.IsValid)
         {
             Service1Client client = new Service1Client();
             switch (submitButton)
             {
                 case "Buscar":
                     var hola = client.getRol(model.id);
                     if (hola == null)
                     {
                         client.Close();
                         return View();
                     }
                     ViewBag.Desc = hola.descripcion;
                     ViewBag.id = hola.rolesid;
                     break;
                 case "Modificar":
                     client.editRol(model.id, model.descripcion);
                     break;
             }
             client.Close();
             return View();
         }
         return View();
     }
     else
         return RedirectToAction("Login", "Home");
 }
 public ActionResult Index(RolesModel model)
 {
     if (Session["User"] != null)
     {
         if (ModelState.IsValid)
         {
             Service1Client client = new Service1Client();
             List<int> idpermisos = splitCadenaID(model.permisosID);
             Session["Roles"] = model.descripcion;
             ViewBag.rol = Session["Roles"];
             if(idpermisos==null)
                 return View();
             client.addRole(model.descripcion);
             foreach (var item in idpermisos)
             {
                 client.addRoles_Permisos(client.getUltimoId_Roles(),item);
             }
            client.Close();
         }
         return View();
     }
     else
     {
         return RedirectToAction("Login", "Home");
     }
 }