コード例 #1
0
        //public HorseBusiness(IHorseRepository horseRepository) {
        //    _horseRepository = horseRepository;
        //}
        public int AddHorse(HorseApiModel horse)
        {
            tblHors newHorse = new tblHors {
                Breed  = horse.Breed,
                Color  = horse.Color,
                Other  = horse.Other,
                Size   = horse.Size,
                UserId = horse.UserId
            };

            return(_horseRepository.AddHorse(newHorse, horse.ImagePaths));
        }
コード例 #2
0
 public int AddHorse(tblHors horse, List <string> ImagePaths)
 {
     _db.tblHorses.Add(horse);
     _db.SaveChanges();
     //foreach (string path in ImagePaths)
     //{
     //    tblHorseImage imagePath = new tblHorseImage
     //    {
     //        HorseId = horse.HorseId,
     //        ImagePath = path
     //    };
     //    _db.tblHorseImages.Add(imagePath);
     //}
     return(horse.HorseId);
 }