public IActionResult GetRecordSpheresBySearch([FromBody] D.RecordSphere searchPrototype) { _logger.LogInformation($"Controller Method invoked: {nameof(GetRecordSpheresBySearch)}"); RecordSphere recordSphere = _mapper.Map <RecordSphere>(searchPrototype); IEnumerable <RecordSphere> model = _recordSpheresLogic.GetRecordSpheresBySearch(recordSphere); IEnumerable <D.RecordSphere> result = _mapper.Map <IEnumerable <D.RecordSphere> >(model); return(new ObjectResult(result)); }
public IEnumerable <RecordSphere> GetRecordSpheresBySearch(RecordSphere searchPrototype) { _logger.LogInformation($"Logic Method invoked: {nameof(GetRecordSpheresBySearch)}"); //ignore: all but Realm and Character var query = _enlirRepository.GetMergeResultsContainer().RecordSpheres; if (searchPrototype.Realm != 0) { query = query.Where(l => l.Realm == searchPrototype.Realm); } if (searchPrototype.CharacterId != 0) { query = query.Where(l => l.CharacterId == searchPrototype.CharacterId); } if (searchPrototype.RecordSphereLevels != null && searchPrototype.RecordSphereLevels.Any() && !String.IsNullOrWhiteSpace(searchPrototype.RecordSphereLevels.First().Benefit)) { query = query.Where( l => l.RecordSphereLevels.Any(i => i.Benefit.ToLower().Contains(searchPrototype.RecordSphereLevels.First().Benefit.ToLower()))); } return(query); }