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