コード例 #1
0
        public async override Task <RoleResource> Map(RoleEntity entity)
        {
            var roleResource = await base.Map(entity);

            var policies = await PolicyLookupRepository.Get(entity.PoliciesId);

            roleResource.Policies = (await PolicyMapper.Map(policies)).ToArray();
            return(roleResource);
        }
コード例 #2
0
        public ILookupService <TType> From <TType>() where TType : class
        {
            if (_bindingManager.Get <TType>() == null)
            {
                throw new Exception();
            }
            var dbSet = _lookupRepository.Get <TType>();

            return(new LookupService <TType>(dbSet, _bindingManager));
        }
コード例 #3
0
        public List <ViewModels.Lookup> GetByKeyValue(string key, string value)
        {
            List <ViewModels.Lookup> list;

            if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(value))
            {
                list =
                    Mapper.Map <List <Lookup>, List <ViewModels.Lookup> >(
                        _lookupRepository.Get(l => l.Key == key && l.Value == value).ToList());
            }
            else
            {
                list =
                    Mapper.Map <List <Lookup>, List <ViewModels.Lookup> >(
                        _lookupRepository.Get(l => l.Key == key).ToList());
            }

            return(list);
        }
コード例 #4
0
        public async override Task <UserResource> Map(UserEntity entity)
        {
            var userResource = await base.Map(entity);

            var rolesIds      = entity.Roles.Select(r => r.Id);
            var rolesEntities = await RoleLookupRepository.Get(rolesIds.ToArray());

            var rolesResources = await RoleMapper.Map(rolesEntities.ToList());

            var userRolesResources = Mapper.Map <IEnumerable <UserRoleResource> >(rolesResources);

            userResource.Roles = userRolesResources.ToArray();
            return(userResource);
        }
コード例 #5
0
 public ICollection <User> GetClockedInUsers()
 {
     return(_usersRepostory.Get().Where(user => user.IsClockedIn).ToList());
 }