예제 #1
0
        public Task AddToRoleAsync(TUser user, string roleName)
        {
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            if (string.IsNullOrEmpty(roleName))
            {
                throw new ArgumentException("Argument cannot be null or empty: roleName.");
            }

            var identRole = roleTable.GetRoleByName(roleName);

            if (!string.IsNullOrEmpty(identRole.Id))
            {
                userRolesTable.Insert(user, identRole.Id);
            }

            return(Task.FromResult <object>(null));
        }
예제 #2
0
        public Task <TRole> FindByNameAsync(string roleName)
        {
            TRole result = roleTable.GetRoleByName(roleName);

            return(Task.FromResult <TRole>(result));
        }