Beispiel #1
0
        public bool CreateCarModel(CarModels instance)
        {
            if (instance.ModelId == 0)
            {
                Db.CarModels.InsertOnSubmit(instance);
                Db.CarModels.Context.SubmitChanges();
                return(true);
            }

            return(false);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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();
        }
Beispiel #5
0
 partial void DeleteCarModels(CarModels instance);
Beispiel #6
0
 partial void UpdateCarModels(CarModels instance);
Beispiel #7
0
 partial void InsertCarModels(CarModels instance);