public ActionResult Create(CarModel model)
        {
            if(ModelState.IsValid)
            {
                if (model.Id == 0)
                {

                    var newCar = new Car
                                     {
                                         Color = model.Color,
                                         OptionsMacroText = model.OptionsMacroText,
                                         Model = model.VehicleModel,
                                         Price = model.Price,
                                         SportsPackage = model.SportsPackage
                                     };

                    Repository.AddCar(newCar);
                    Repository.Context.SaveChanges();
                    model.Id = newCar.Id;
                    return View("Details", model);
                }
            }
            SetDropDownLists();
            return View("Create");
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Cars EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCars(Car car)
 {
     base.AddObject("Cars", car);
 }
 /// <summary>
 /// Create a new Car object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 public static Car CreateCar(global::System.Int32 id)
 {
     Car car = new Car();
     car.Id = id;
     return car;
 }