public Car CreateCar(string carDescription, double carFuelEconomy, string carPictureUrl, ICollection<int> carFeaturesIds, CarTypes carCarType) { var carToAdd = new Car { Description = carDescription, FuelEconomy = carFuelEconomy, PictureUrl = carPictureUrl, CarType = carCarType }; //this.cars.Add(carToAdd); //this.cars.SaveChanges(); foreach (var featureId in carFeaturesIds) { var feature = this.features.GetById(featureId); feature.Cars.Add(carToAdd); } this.features.SaveChanges(); return carToAdd; }
public void UpdateCar(Car carToUpdate) { this.cars.Update(carToUpdate); this.cars.SaveChanges(); }