public int AddCar(string registrationNumber, int? customerId,int carModelId) { Car newCar = new Car { RegistrationNumber = registrationNumber.Replace(" ", "").Trim(), CustomerId = customerId, CarModelId = carModelId }; db.Cars.InsertOnSubmit(newCar); Save(); return newCar.Id; }
partial void DeleteCar(Car instance);
partial void UpdateCar(Car instance);
partial void InsertCar(Car instance);
private void detach_Cars(Car entity) { this.SendPropertyChanging(); entity.CarModel = null; }
private void attach_Cars(Car entity) { this.SendPropertyChanging(); entity.CarModel = this; }
private void attach_Cars(Car entity) { this.SendPropertyChanging(); entity.Customer = this; }
public ActionResult AddNewCar(string re, int carModelId) { Car newCar = new Car { CarModelId = carModelId, RegistrationNumber = re.Trim() }; db.Cars.InsertOnSubmit(newCar); db.SubmitChanges(); Session.Remove("car"); Session.Add("car", newCar); return RedirectToAction("Index"); }