public void SaveRole(Role role, bool savePermission) { int roleId = manager.SaveRole(role.RoleId, role.RoleName); if (savePermission == true) { manager.DeleteRolePermissionByRoleId(role.RoleId); for (int i = 0; i < role.Permissions.Count; i++) { manager.SaveRolePermission(roleId, role.Permissions[i].PermissionId); } } }