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"); } }