コード例 #1
0
        public async Task <IEnumerable <AccessGroupModel> > GetAll()
        {
            var accessGroups = await _accessGroupRepository.GetAll();

            var departments = await _misService.GetAllDepartments();

            var applications = await _ISsoService.GetAllApplications();

            return(await Task.FromResult(
                       from accessGroup in accessGroups
                       join department in departments
                       on accessGroup.DepartmentId equals department.DepartmentId into dep
                       from department in dep.DefaultIfEmpty()
                       join application in applications
                       on accessGroup.ApplicationId equals application.ApplicationId into app
                       from application in app.DefaultIfEmpty()
                       select new AccessGroupModel
            {
                AccessGroupId = accessGroup.AccessGroupId,
                Name = accessGroup.Name,
                Description = accessGroup.Description,
                ApplicationId = accessGroup.ApplicationId,
                DepartmentId = department?.DepartmentId ?? 0,
                DepartmentName = department?.DepartmentName ?? string.Empty,
                ApplicationName = application.ApplicationName ?? string.Empty,
                LastUpdated = accessGroup.LastUpdated,
                IsActive = accessGroup.IsActive,
                CreatedBy = accessGroup.CreatedBy,
                LastUpdatedBy = accessGroup.LastUpdatedBy,
                AccessGroupModulePermissions =
                    ObjectMapper.Mapper.Map <ICollection <AccessGroupModulePermissionModel> >(accessGroup
                                                                                              .AccessGroupModulePermissions)
            }));
        }
コード例 #2
0
        public async Task <IEnumerable <ModuleModel> > GetAll()
        {
            var modules = await _moduleRepository.GetAll();

            var applications = await _ssoService.GetAllApplications();

            return(await Task.FromResult(
                       from module in modules
                       join application in applications
                       on module.ApplicationId equals application.ApplicationId into app
                       from application in app.DefaultIfEmpty()
                       select new ModuleModel
            {
                ModuleId = module.ModuleId,
                ApplicationId = module.ApplicationId,
                ApplicationName = application.ApplicationName,
                Code = module.Code,
                Name = module.Name,
                IsActive = module.IsActive,
                ParentModule =
                    ObjectMapper.Mapper.Map <ModuleModel>(module.ParentModule),
                ModuleType =
                    ObjectMapper.Mapper.Map <ModuleTypeModel>(module.ModuleType)
            }));
        }
コード例 #3
0
        public async Task <IEnumerable <AccessGroupAssignmentModel> > GetAll()
        {
            var accessGroupAssignments = await _accessGroupAssignmentRepository.GetAll();

            var departments = await _misService.GetAllDepartments();

            var roles = await _misService.GetAllRoles();

            var positions = await _misService.GetPositions();

            var applications = await _ssoService.GetAllApplications();

            return(await Task.FromResult(
                       from accessGroupAssignment in accessGroupAssignments
                       join department in departments
                       on accessGroupAssignment.AccessGroup.DepartmentId equals department.DepartmentId into dep
                       from department in dep.DefaultIfEmpty()
                       join application in applications
                       on accessGroupAssignment.AccessGroup.ApplicationId equals application.ApplicationId
                       join position in positions
                       on accessGroupAssignment.PositionId equals position.PositionId into position
                       from pos in position.DefaultIfEmpty()
                       join role in roles
                       on accessGroupAssignment.RoleId equals role.RoleId into role
                       from rol in role.DefaultIfEmpty()
                       select new AccessGroupAssignmentModel
            {
                AccessGroupAssignmentId = accessGroupAssignment.AccessGroupAssignmentId,
                AccessGroupId = accessGroupAssignment.AccessGroupId,
                Name = accessGroupAssignment.AccessGroup.Name,
                ApplicationId = accessGroupAssignment.AccessGroup.ApplicationId,
                ApplicationName = application.ApplicationName,
                DepartmentId = department?.DepartmentId ?? 0,
                DepartmentName = department?.DepartmentName ?? string.Empty,
                RoleId = accessGroupAssignment.RoleId,
                RoleName = rol?.RoleName ?? string.Empty,
                PositionId = accessGroupAssignment.PositionId,
                PositionName = pos?.PositionName ?? string.Empty,
                PersonId = accessGroupAssignment.PersonId,
                LastUpdatedBy = accessGroupAssignment.LastUpdatedBy,
            }));
        }
コード例 #4
0
        public async Task <ActionResult <IEnumerable <ApplicationModel> > > GetAll()
        {
            _logger.LogInformationExtension("Get All Applications");
            var applications = await _ssoService.GetAllApplications();

            string message;

            if (applications == null)
            {
                message = "No applications found";
                _logger.LogErrorExtension(message, null);
                return(NotFound(new Models.Response <ApplicationModel>(false, message)));
            }

            message = $"Found {applications.Count()} applications";

            _logger.LogInformationExtension(message);

            return(Ok(new Models.Response <IEnumerable <ApplicationModel> >(applications, message)));
        }