Exemple #1
0
        public GroupSaveViewModel PostSave(EasyADGroup group)
        {
            var groupManager = ManagerFactory.GetManager();

            string message = "";

            if (!ValidateGroup(group.Name, groupManager, ref message))
            {
                return(FailedSave(message));
            }

            if (!ValidUserType(group.UserType))
            {
                return(FailedSave("Invalid User Type!"));
            }

            if (!ValidateSections(group.Sections, ref message))
            {
                return(FailedSave(message));
            }

            var repo    = new EasyADRepository(DatabaseContext.Database, DatabaseContext.SqlSyntax);
            var handler = new SaveGroupHandler(repo, groupManager, Services.UserService);
            var groupId = handler.Handle(group);

            return(new GroupSaveViewModel
            {
                GroupId = groupId,
                Success = true,
                Message = "Group created!"
            });
        }
Exemple #2
0
        public int DeleteById(int id)
        {
            var groupManager = ManagerFactory.GetManager();
            var repo         = new EasyADRepository(DatabaseContext.Database, DatabaseContext.SqlSyntax);
            var handler      = new DeleteGroupHandler(repo, groupManager, Services.UserService);

            return(handler.Handle(id));
        }
        public void Execute()
        {
            lock (_lock)
            {
                if (_shuttingDown)
                {
                    return;
                }

                var appContext   = ApplicationContext.Current;
                var repo         = new EasyADRepository(appContext.DatabaseContext.Database, appContext.DatabaseContext.SqlSyntax);
                var groupManager = ManagerFactory.GetManager();
                var handler      = new RefreshGroupsHandler(repo, groupManager, appContext.Services.UserService);
                handler.Handle();
            }
        }
Exemple #4
0
        public IEnumerable <EasyADGroup> GetAll()
        {
            var repo = new EasyADRepository(DatabaseContext.Database, DatabaseContext.SqlSyntax);

            return(repo.GetAll());
        }
Exemple #5
0
        // sample url: /umbraco/backoffice/EasyAD/EasyADApi/GetById?groupId=1
        public EasyADGroup GetById(int id)
        {
            var repo = new EasyADRepository(DatabaseContext.Database, DatabaseContext.SqlSyntax);

            return(repo.GetById(id));
        }