Exemplo n.º 1
0
        public ActionResult Index(RolView dcv)
        {
            try
            {
                string nombreRol = Request.Form["txtNombreRol"];

                RolRepository dr    = new RolRepository();
                List <Rol>    Roles = dr.Listar(nombreRol);

                dcv.Rol        = new Rol();
                dcv.Rol.Nombre = nombreRol;
                dcv.Roles      = Roles;

                string mensaje = "";
                if (Roles.Count == 0)
                {
                    mensaje = "No existen Roles para el criterio de búsqueda";
                }
                dcv.Mensaje = mensaje;

                return(View(dcv));
            }
            catch (Exception ex)
            {
                return(View("Mensaje", new RolView {
                    Mensaje = ex.Message
                }));
            }
        }
Exemplo n.º 2
0
        public JsonResult Listar(string id)
        {
            RolRepository dr    = new RolRepository();
            List <Rol>    Roles = dr.Listar(id);

            //string resultado = JsonConvert.SerializeObject(Roles);

            return(Json(Roles, JsonRequestBehavior.AllowGet));
        }