コード例 #1
0
        public static Models.Horse WithSire(this Models.Horse horse, int id = 3, string name = "Sire")
        {
            var sire = Create(_context, id, name);

            horse.Sire   = sire;
            horse.SireId = sire.Id;

            return(horse);
        }
コード例 #2
0
        public static Models.Horse WithDam(this Models.Horse horse, int id = 2, string name = "Dam")
        {
            var dam = Create(_context, id, name);

            horse.Dam   = dam;
            horse.DamId = dam.Id;

            return(horse);
        }
コード例 #3
0
        public static Models.Horse WithColor(this Models.Horse horse)
        {
            var color = ColorFactory.Create(_context);

            horse.Color   = color;
            horse.ColorId = color.Id;

            return(horse);
        }
コード例 #4
0
 private static Dto.Horse Map(Models.Horse horse)
 {
     return(new Dto.Horse
     {
         Id = horse.Id,
         Name = horse.Name,
         Color = horse.Color.Name,
         Dam = horse.Dam != null ? horse.Dam.Name : string.Empty,
         DamId = horse.DamId,
         Sire = horse.Sire != null ? horse.Sire.Name : string.Empty,
         SireId = horse.SireId
     });
 }
コード例 #5
0
 private static Dto.Horse Map(Models.Horse horse)
 {
     return(new Dto.Horse
     {
         Id = horse.Id,
         Name = horse.Name,
         Starts = horse.RaceStarts,
         Win = horse.RaceWins,
         Place = horse.RacePlace,
         Show = horse.RaceShow,
         Earnings = horse.Earnings
     });
 }
コード例 #6
0
        public static Models.Horse Create(FakeDataContext context, int id = 1, string name = "Man o' War")
        {
            _context = context;
            Setup(context);

            var horse = new Models.Horse
            {
                Id   = id,
                Name = name
            };

            context.Horses.Add(horse);

            return(horse);
        }
コード例 #7
0
ファイル: HorseFacade.cs プロジェクト: ssuing8825/HorseFarm
 public void Update(int id, Models.Horse horse)
 {
     repository.Update(id, horse);
     notification.SendHorseChangedMessage(horse);
 }
コード例 #8
0
ファイル: HorseFacade.cs プロジェクト: ssuing8825/HorseFarm
 public void Post(Models.Horse horse)
 {
     repository.Post(horse);
     notification.SendHorseChangedMessage(horse);
 }