public IEnumerable <MarketFeedModel> Get(HtmlNode matchContainer, MatchFeedModel match) { ICollection <MarketFeedModel> markets = new List <MarketFeedModel>(); HtmlNodeCollection marketNodes = matchContainer.SelectNodes(MatchXPaths.MARKETS); foreach (var marketNode in marketNodes) { IList <string> oddNames = htmlService.GetOddNames(marketNode); MarketFeedModel market = ObjectFactory.CreateMarket(marketNode.FirstChild.FirstChild.InnerText, match.Key); market.Odds = oddsProvider.Get(marketNode, oddNames); markets.Add(market); } return(markets); }
public string Manage(MarketFeedModel feedModel, string matchId) { IEnumerable <int> keys = new List <int>() { feedModel.Key }; EntitiesByKeyQuery <Market> query = new EntitiesByKeyQuery <Market>(keys); Market market = queryDispatcher.Dispatch <EntitiesByKeyQuery <Market>, IEnumerable <Market> >(query).FirstOrDefault(); if (market != null) { return(market.Id); } CreateMarketCommand command = Mapper.Map <CreateMarketCommand>(feedModel); command.MatchId = matchId; return(commandDispatcher.Dispatch <CreateMarketCommand, string>(command)); }