public ActionResult Agregar(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here
                RolesComponent rolesComponent = new RolesComponent();
                Roles          roles          = new Roles();
                Roles          roles1         = new Roles();

                roles1.Id     = int.Parse(collection.Get("name"));
                roles.Id      = int.Parse(collection.Get("id"));
                roles.permiso = roles1;
                rolesComponent.CreateComposite(roles);
                return(RedirectToAction("VerPermisos", new { id = int.Parse(collection.Get("id")) }));
            }
            catch (Exception e)
            {
                return(View());
            }
        }
Example #2
0
        private void btnAsignarPermiso_Click(object sender, EventArgs e)
        {
            if (mgAsignarLista.CurrentRow.Cells[0].Value == null || mgDisponible.CurrentRow.Cells[0].Value == null)
            {
                MetroMessageBox.Show(this, "No selecciono el rol o el permiso a asignar", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            }
            else
            {
                Roles roles = new Roles();
                roles.Id = int.Parse(mgAsignarLista.CurrentRow.Cells[0].Value.ToString());
                Roles unRol = new Roles();
                unRol.Id      = int.Parse(mgDisponible.CurrentRow.Cells[0].Value.ToString());
                roles.permiso = unRol;
                RolesComponent rolesComponent = new RolesComponent();
                if (rolesComponent.CreateComposite(roles) == null)
                {
                    MetroMessageBox.Show(this, "No se puede asiganr el rol o el permiso, el rol: " + mgDisponible.CurrentRow.Cells[1].Value.ToString() + " contiente el rol o permiso: " + mgAsignarLista.CurrentRow.Cells[1].Value.ToString(), "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                }

                ;
                llenarGrillaAsignar();
            }
        }