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

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