public IQueryable<Car> GetCarsByCarModel(CarModel model) { if (model == null) return null; return db.Cars.Where(x => x.CarModel.ID == model.ID); }
public void Update(CarModel carModel) { CarModel rCarModel = GetCarModelById(carModel.ID); if (rCarModel == null) return; rCarModel.Cars = carModel.Cars; rCarModel.Name = carModel.Name; rCarModel.Range = carModel.Range; rCarModel.Website = carModel.Website; rCarModel.Year = carModel.Year; db.SaveChanges(); }
public void Insert(CarModel carModel) { db.CarModels.Add(carModel); db.SaveChanges(); }