Initial commit
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
using SwiftyMessageHub.Core;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AutoBet.DataRecorded.MessageControllers
|
||||
{
|
||||
public class PreRaceDataCollectorController : MessageController
|
||||
{
|
||||
[MessageRoute]
|
||||
public async Task CollectPreRaceData(PreRaceDataCollectDetails details)
|
||||
{
|
||||
var client = new BritishHorseRacingApi.ApiClient();
|
||||
var date = details.DateToCollect;
|
||||
Console.WriteLine("Loading races");
|
||||
var races = await client.GetAllRacesForDay(date.Year, date.Month, date.Day);
|
||||
foreach (var race in races)
|
||||
{
|
||||
Console.WriteLine($"Race id {race.RaceId} loaded");
|
||||
await CurrentContext.Hub.SendMessage(race);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user