예제 #1
0
        public async Task <Page <UserRoleGrid> > GetGrid(GridRequest gridRequest, int?userId, int?roleId)
        {
            if (!userId.HasValue && !roleId.HasValue)
            {
                throw new CallerException("UserId or RoleId is required");
            }

            var data = new Page <UserRoleGrid>();

            using (var uow = new UnitOfWork(Context))
            {
                var repo = new UserRoleRepository(uow);

                var query = repo.GetAllForGrid(userId, roleId);

                var dataGridLogic = new DataGridLogic <UserRoleGrid>(gridRequest, query);

                data.Records = await dataGridLogic.GetResults(); //TODO this wont work

                data.PageSize         = dataGridLogic.PageSize;
                data.PageOffset       = dataGridLogic.PageOffset;
                data.TotalRecordCount = dataGridLogic.TotalRecordCount;
                data.SortExpression   = dataGridLogic.SortExpression;
            }

            return(data);
        }
        public async Task <Page <UserLoginHistory> > GetGrid(GridRequest gridRequest, int userId)
        {
            var data = new Page <UserLoginHistory>();

            using (var uow = new UnitOfWork(Context))
            {
                var repo = new UserLoginHistoryRepository(uow);

                var query = repo.GetAll().Where(u => u.UserId == userId);

                var dataGridLogic = new DataGridLogic <UserLoginHistory>(gridRequest, query);

                data.Records = await dataGridLogic.GetResults();

                data.PageSize         = dataGridLogic.PageSize;
                data.PageOffset       = dataGridLogic.PageOffset;
                data.TotalRecordCount = dataGridLogic.TotalRecordCount;
                data.SortExpression   = dataGridLogic.SortExpression;
            }

            return(data);
        }
예제 #3
0
        public async Task <Page <ProfileProperty> > GetGrid(GridRequest gridRequest)
        {
            var data = new Page <ProfileProperty>();

            using (var uow = new UnitOfWork(Context))
            {
                var repo = new ProfilePropertyRepository(uow);

                var query = repo.GetAll();

                var dataGridLogic = new DataGridLogic <ProfileProperty>(gridRequest, query);

                data.Records = await dataGridLogic.GetResults();

                data.PageSize         = dataGridLogic.PageSize;
                data.PageOffset       = dataGridLogic.PageOffset;
                data.TotalRecordCount = dataGridLogic.TotalRecordCount;
                data.SortExpression   = dataGridLogic.SortExpression;
            }

            return(data);
        }
예제 #4
0
        public async Task <Page <GridUser> > GetGrid(GridRequest gridRequest, int?profilePropertyId, string searchText, SearchOperator?searchOperator, bool includeDeleted)
        {
            var data = new Page <GridUser>();

            using (var uow = new UnitOfWork(Context))
            {
                var repo = new UserRepository(uow);

                var userQuery = repo.GetAllForGrid(profilePropertyId, searchText, searchOperator, includeDeleted);

                var dataGridLogic = new DataGridLogic <GridUser>(gridRequest, userQuery);

                data.Records = await dataGridLogic.GetResults();

                data.PageSize         = dataGridLogic.PageSize;
                data.PageOffset       = dataGridLogic.PageOffset;
                data.TotalRecordCount = dataGridLogic.TotalRecordCount;
                data.SortExpression   = dataGridLogic.SortExpression;
            }

            return(data);
        }