public HttpResponseMessage GetRoles(PermissionsViewModel model)
        {
            try
            {
                if (string.IsNullOrEmpty(model.IdPermission))
                {
                    model.success = "true";
                    return(this.Request.CreateResponse <PermissionsViewModel>(HttpStatusCode.OK, model));
                }
                else
                {
                    int id = int.Parse(model.IdPermission);
                    List <ApplicationRole> roles = ApplicationRoleManager.GetPermission(id).ROLES;
                    model.success    = "true";
                    model.ListGruppi = roles;
                    model.Totale     = roles.Count.ToString();
                }
            }

            catch (Exception ex)
            {
                model.success = "false";
                model.message = ex.Message;
            }
            return(this.Request.CreateResponse <PermissionsViewModel>(HttpStatusCode.OK, model));
        }
        public ActionResult PermissionEdit(int id)
        {
            PERMISSION _permission = ApplicationRoleManager.GetPermission(id);

            ViewBag.RoleId = new SelectList(ApplicationRoleManager.GetRoles4SelectList(), "Id", "Name");
            return(View(_permission));
        }
 public PartialViewResult AddRole2PermissionReturnPartialView(int permissionId, int roleId)
 {
     ApplicationRoleManager.AddPermission2Role(roleId, permissionId);
     return(PartialView("_ListRolesTable4Permission", ApplicationRoleManager.GetPermission(permissionId)));
 }
 public PartialViewResult DeleteRoleFromPermissionReturnPartialView(int id, int permissionId)
 {
     ApplicationRoleManager.RemovePermission4Role(id, permissionId);
     return(PartialView("_ListRolesTable4Permission", ApplicationRoleManager.GetPermission(permissionId)));
 }
 public ViewResult PermissionDetails(int id)
 {
     return(View(ApplicationRoleManager.GetPermission(id)));
 }