public IHttpActionResult AddHorseBox(tblHorseBox horseBox) { var result = _horseBoxBusiness.AddHorseBox(horseBox); if (result > 0) { return(Ok(result)); } else { return(Ok(false)); } }
public int AddHorseBox(TransporterApiModel transporter) { tblHorseBox horseBox = new tblHorseBox() { Age = transporter.Age, HasAccomodation = transporter.HasAccomodation, HasCameras = transporter.HasCameras, IsAirConditioned = transporter.IsAirConditioned, RampId = transporter.RampId, Tonnage = transporter.Tonnage, UserId = transporter.UserId }; return(_horseBoxRepository.AddHorseBox(horseBox, transporter.ImagePaths)); }
public int AddHorseBox(tblHorseBox horseBox, List <string> imagePaths) { _db.tblHorseBoxes.Add(horseBox); _db.SaveChanges(); //foreach (string imagePath in imagePaths) //{ // tblHorseBoxImage horseBoxImage = new tblHorseBoxImage // { // HorseBoxId = horseBox.HorseBoxId, // ImagePath = imagePath // }; // _db.tblHorseBoxImages.Add(horseBoxImage); //} _db.SaveChanges(); return(horseBox.HorseBoxId); }