public async Task <FixtureResponse <Models.Participant> > GetParticipants(FeedProviderType type)
        {
            if (providers.TryGetValue(type, out IDataFeed provider))
            {
                return(await provider.GetParticipants());
            }

            throw new System.ArgumentException("Value not recognised", "type");
        }
Beispiel #2
0
        static async void PrintHorsesOrdered(FeedProviderType type)
        {
            var manager      = new DataFeedProvider();
            var participants = await manager.GetParticipants(type);

            if (participants.IsValid)
            {
                // sorting can be pushed down to the business object
                // if it is a business requirement or just a display requirement?
                var sortedList = participants.Data.OrderBy(x => x.Price);
                foreach (var e in sortedList)
                {
                    Console.WriteLine($"{e.Name} {e.Price}");
                }
            }
            else
            {
                Console.WriteLine(participants.Error);
            }
        }