Initial commit
This commit is contained in:
+77
@@ -0,0 +1,77 @@
|
||||
using BritishHorseRacingApi.Models;
|
||||
using SwiftyMessageHub.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AutoBet.DataRecorded.PreRaceRunnerRecorder
|
||||
{
|
||||
public class PreRaceRunnerRecorderController : MessageController
|
||||
{
|
||||
[MessageRoute]
|
||||
public async Task RecordRunner(Runner details)
|
||||
{
|
||||
Console.WriteLine($"Saving runner {details.RacehorseName}");
|
||||
using (var db = new Db.HorseRacingDataContext())
|
||||
{
|
||||
db.Runners.Add(new Db.Runner()
|
||||
{
|
||||
HeadGearWearingCode = details.HeadGearWearingCode,
|
||||
HeadGearWearingSheepSkin = details.HeadGearWearingSheepSkin,
|
||||
HeadGearDescription = details.HeadGearDescription,
|
||||
HeadGearAbbreviation = details.HeadGearAbbreviation,
|
||||
JockeyProfile = details.JockeyProfile,
|
||||
CourseWinner = details.CourseWinner,
|
||||
DistanceWinner = details.DistanceWinner,
|
||||
WindSurgeryFirstRun = details.WindSurgeryFirstRun,
|
||||
TrainerId = details.TrainerId,
|
||||
TrainerName = details.TrainerName,
|
||||
OwnerId = details.OwnerId,
|
||||
OwnerName = details.OwnerName,
|
||||
WbSilkCode = details.WbSilkCode,
|
||||
WbSilkDescription = details.WbSilkDescription,
|
||||
SilkImage = details.SilkImage,
|
||||
Plus10 = details.Plus10,
|
||||
ForecastPriceNumerator = details.ForecastPriceNumerator,
|
||||
ForecastPriceDenominator = details.ForecastPriceDenominator,
|
||||
WeightText = details.WeightText,
|
||||
WeightsJockeyClaiming = details.WeightsJockeyClaiming,
|
||||
Odds = details.Odds,
|
||||
DecimalOdds = details.DecimalOdds(),
|
||||
JockeyName = details.JockeyName,
|
||||
Status = (Db.Status)details.Status,
|
||||
RaceId = details.RaceId,
|
||||
YearOfRace = details.YearOfRace,
|
||||
DivisionSequence = details.DivisionSequence,
|
||||
AnimalId = details.AnimalId,
|
||||
RacehorseName = details.RacehorseName,
|
||||
AgeYears = details.AgeYears,
|
||||
Bred = details.Bred,
|
||||
ClothNumber = details.ClothNumber,
|
||||
DrawnStall = details.DrawnStall,
|
||||
ReserveNumber = details.ReserveNumber,
|
||||
BhaRating = details.BhaRating,
|
||||
FormFigures = details.FormFigures,
|
||||
WeightValue = details.WeightValue,
|
||||
PenaltyValue = details.PenaltyValue,
|
||||
SexType = (Db.SexType)details.SexType,
|
||||
NonRunnerDeclaredReason = details.NonRunnerDeclaredReason,
|
||||
NonRunnerDeclaredDate = details.NonRunnerDeclaredDate,
|
||||
NonRunnerDeclaredTime = details.NonRunnerDeclaredTime,
|
||||
RunnerNumber = details.RunnerNumber,
|
||||
JockeyId = details.JockeyId,
|
||||
RaceHorseNameWithoutCountry = details.RacehorseNameWithoutCountry,
|
||||
WeightInGrams = details.WeightInGrams,
|
||||
LastRuns = details.LastRuns?.Select(e => new Db.LastRun()
|
||||
{
|
||||
Days = e.Days,
|
||||
RaceType = e.RaceType
|
||||
}).ToList()
|
||||
});
|
||||
await db.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user