/// <summary> /// Add model /// </summary> public static void AddModel(ModelCar car) { using (CarsEntity autorentEntityContext = new CarsEntity()) { try { Autorent.Models.Auto.AutoModel autoModel = new Autorent.Models.Auto.AutoModel { Id = Guid.NewGuid(), Maker = car.Make, ConceptName = car.ModelAuto, Year = (short)car.Year, Class = ((int)car.ClassAuto).ToString() }; autorentEntityContext.AutoModels.AddObject(autoModel); autorentEntityContext.SaveChanges(); } catch (InvalidOperationException ex) { throw ex; } } }
/// <summary> /// Create a new AutoModel object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="maker">Initial value of the Maker property.</param> public static AutoModel CreateAutoModel(global::System.Guid id, global::System.String maker) { AutoModel autoModel = new AutoModel(); autoModel.Id = id; autoModel.Maker = maker; return autoModel; }
/// <summary> /// Deprecated Method for adding a new object to the AutoModel EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToAutoModel(AutoModel autoModel) { base.AddObject("AutoModel", autoModel); }