Example #1
0
 public static Horse BuildHorseForDB(EntryFromXML entry)
 {
     var horse = new Horse
         {
             HorseName = entry.Name
         };
     return horse;
 }
Example #2
0
 public static Horse GetHorse(EntryFromXML entry)
 {
     var uow = Program.Context.CreateUnitOfWork();
     var retVal = uow.Horses.FirstOrDefault(x => x.HorseName == entry.Name);
     if (retVal == null)
     {
         retVal = BuildHorseForDB(entry);
         uow.Add(retVal);
         uow.SaveChanges();
     }
     uow.Dispose();
     return retVal;
 }
Example #3
0
 public static HorseInRace BuildEntryForDB(EntryFromXML xmlEntry, Race race)
 {
     if (xmlEntry.JockeyAllowance == null) xmlEntry.JockeyAllowance = "0";
     if (xmlEntry.JockeyWeight == null) xmlEntry.JockeyWeight = "0";
     if (xmlEntry.Number == null) xmlEntry.Number = "0";
     if (xmlEntry.Scratched == null) xmlEntry.Scratched = "0";
     var horseInRace = new HorseInRace
         {
             Barrier = xmlEntry.Barrier,
             Jockey = JockeyController.GetJockey(xmlEntry.Jockey),
             JockeyAllowance = xmlEntry.JockeyAllowance,
             JockeyWeight = decimal.Parse(xmlEntry.JockeyWeight),
             Name = xmlEntry.Name,
             Number = int.Parse(xmlEntry.Number),
             Race = race,
             Scratched = int.Parse(xmlEntry.Scratched),
             Horse = HorseController.GetHorse(xmlEntry)
         };
     return horseInRace;
 }