public IQueryable <BonusViewModel> GetAll(MajorType major, int?filter = null) { var query = _bonusRepository.Select(major).ProjectTo <BonusViewModel>(MapperConfig); return(filter is null ? query : query.Where(x => (int)x.Type == filter)); }