public void Handle(PlayerYearAdded theEvent) { //add this to Solr var hitter = new Hitter() { Average = theEvent.Average, Doubles = theEvent.Doubles, FirstName = theEvent.FirstName, Hits = theEvent.Hits, HomeRuns = theEvent.HomeRuns, Id = String.Format("{0}_{1}", theEvent.Id.ToString(), theEvent.Year.ToString()), LahmanId = theEvent.Id, LastName = theEvent.LastName, PlayerId = theEvent.PlayerId, RunsBattedIn = theEvent.RunsBattedIn, Salary = theEvent.Salary, StrikeOuts = theEvent.StrikeOuts, TeamName = theEvent.Team, Triples = theEvent.Triples, Year = theEvent.Year }; var search = SearchFactory.GetSearchService(); search.AddHitter(hitter); }
public IActionResult GetHitResults([FromBody] SearchCondition condition) { if (string.IsNullOrEmpty(_engineList)) { return(BadRequest("No search engine")); } var engingList = _engineList.Split(","); var totalResults = new List <HitResultsView>(); if (string.IsNullOrEmpty(condition.SearchUrl)) { return(Ok(totalResults)); } foreach (var engine in engingList) { // Simple Factory pattern to create the search enginge services var service = SearchFactory.GetSearchService(engine); if (service != null) { var searchResults = service.GetSearchResults(condition.SearchKeyword); var hitResults = service.GetHitResults(condition.SearchUrl, searchResults); var HitResultsView = new HitResultsView() { SearchEngineName = engine, ResultList = hitResults }; totalResults.Add(HitResultsView); } } ; return(Ok(totalResults)); }