//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)); }
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); }