示例#1
0
        internal static async Task <IEnumerable <Role> > QueryIdentityRolesAsync(ControllerObject controllerObject, int identityId)
        {
            controllerObject.CheckArgument(nameof(controllerObject));

            var result = new List <Role>();

            using var identityXRoleCtrl = new Controllers.Persistence.Account.IdentityXRoleController(controllerObject);
            var roles = await identityXRoleCtrl.QueryIdentityRolesAsync(identityId)
                        .ConfigureAwait(false);

            result.AddRange(roles);
            return(result);
        }
        internal static async Task <IEnumerable <Role> > QueryIdentityRolesAsync(Controllers.ControllerObject controllerObject, int identityId)
        {
            controllerObject.CheckArgument(nameof(controllerObject));

            List <Role> result = new List <Role>();

            using var identityXRoleCtrl = new Controllers.Persistence.Account.IdentityXRoleController(controllerObject);
            using var roleCtrl          = new Controllers.Persistence.Account.RoleController(controllerObject);

            foreach (var item in identityXRoleCtrl.ExecuteQuery(e => e.IdentityId == identityId).ToList())
            {
                var entity = await roleCtrl.ExecuteGetByIdAsync(item.RoleId).ConfigureAwait(false);

                if (entity != null)
                {
                    var role = new Role();

                    role.CopyProperties(entity);
                    result.Add(role);
                }
            }
            return(result);
        }
示例#3
0
 public static Contracts.Client.IControllerAccess <I> Create <I>(object sharedController) where I : Contracts.IIdentifiable
 {
     Contracts.Client.IControllerAccess <I> result;
     if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Language.ITranslation))
     {
         result = new Controllers.Persistence.Language.TranslationController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>;
     }
     else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Data.IBinaryData))
     {
         result = new Controllers.Persistence.Data.BinaryDataController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>;
     }
     else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Configuration.IIdentitySetting))
     {
         result = new Controllers.Persistence.Configuration.IdentitySettingController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>;
     }
     else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Configuration.ISetting))
     {
         result = new Controllers.Persistence.Configuration.SettingController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>;
     }
     else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.App.IAward))
     {
         result = new Controllers.Persistence.App.AwardController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>;
     }
     else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.App.IJuror))
     {
         result = new Controllers.Persistence.App.JurorController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>;
     }
     else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.App.IMember))
     {
         result = new Controllers.Persistence.App.MemberController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>;
     }
     else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.App.IProject))
     {
         result = new Controllers.Persistence.App.ProjectController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>;
     }
     else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.App.IRating))
     {
         result = new Controllers.Persistence.App.RatingController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>;
     }
     else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Account.IAccess))
     {
         result = new Controllers.Persistence.Account.AccessController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>;
     }
     else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Account.IActionLog))
     {
         result = new Controllers.Persistence.Account.ActionLogController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>;
     }
     else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Account.IIdentity))
     {
         result = new Controllers.Persistence.Account.IdentityController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>;
     }
     else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Account.IIdentityXRole))
     {
         result = new Controllers.Persistence.Account.IdentityXRoleController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>;
     }
     else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Account.ILoginSession))
     {
         result = new Controllers.Persistence.Account.LoginSessionController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>;
     }
     else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Account.IRole))
     {
         result = new Controllers.Persistence.Account.RoleController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>;
     }
     else if (typeof(I) == typeof(QnSProjectAward.Contracts.Persistence.Account.IUser))
     {
         result = new Controllers.Persistence.Account.UserController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>;
     }
     else if (typeof(I) == typeof(QnSProjectAward.Contracts.Business.Account.IAppAccess))
     {
         result = new Controllers.Business.Account.AppAccessController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>;
     }
     else if (typeof(I) == typeof(QnSProjectAward.Contracts.Business.Account.IIdentityUser))
     {
         result = new Controllers.Business.Account.IdentityUserController(sharedController as Controllers.ControllerObject) as Contracts.Client.IControllerAccess <I>;
     }
     else
     {
         throw new Logic.Modules.Exception.LogicException(Modules.Exception.ErrorType.InvalidControllerType);
     }
     return(result);
 }