public bool CreateCarModel(CarModels instance) { if (instance.ModelId == 0) { Db.CarModels.InsertOnSubmit(instance); Db.CarModels.Context.SubmitChanges(); return(true); } return(false); }
public bool RemoveCarModel(int idCarModel) { CarModels instance = Db.CarModels.Where(p => p.ModelId == idCarModel).FirstOrDefault(); if (instance != null) { Db.CarModels.DeleteOnSubmit(instance); Db.CarModels.Context.SubmitChanges(); return(true); } return(false); }
public bool UpdateCarModel(CarModels instance) { CarModels cache = Db.CarModels.Where(p => p.ModelId == instance.ModelId).FirstOrDefault(); if (cache != null) { //TODO : Update fields for CarModel Db.CarModels.Context.SubmitChanges(); return(true); } return(false); }
public void dbInsert(string[] inStr) { if (inStr.Length < 2) { throw new Exception("low Array Lenght"); } var newRole = new CarModels { BrandName = inStr[0], ModelName = inStr[1] }; context.CarModels.InsertOnSubmit(newRole); context.CarModels.Context.SubmitChanges(); }
partial void DeleteCarModels(CarModels instance);
partial void UpdateCarModels(CarModels instance);
partial void InsertCarModels(CarModels instance);