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); }
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)); }
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); }
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); }
public ICollection <User> GetClockedInUsers() { return(_usersRepostory.Get().Where(user => user.IsClockedIn).ToList()); }