Пример #1
0
        // INSERT INTO a_Product VALUE a_Product
        public void CreateNewa_Product(Xsis_Shop_ViewModels.a_ProductViewModel a_Product)
        {
            using (ShopDBEntities db = new ShopDBEntities())
            {
                Xsis_Shop_Models.a_Product Model = new Xsis_Shop_Models.a_Product();
                Model.Code = a_Product.Code;
                Model.Name = a_Product.Name;

                db.a_Product.Add(Model);
                db.SaveChanges();
            }
        }
Пример #2
0
        // UPDATE
        public void Updatea_Product(Xsis_Shop_ViewModels.a_ProductViewModel a_Product)
        {
            using (ShopDBEntities db = new ShopDBEntities())
            {
                Xsis_Shop_Models.a_Product Model = new Xsis_Shop_Models.a_Product();
                Model.ID   = a_Product.ID;
                Model.Code = a_Product.Code;
                Model.Name = a_Product.Name;

                db.Entry(Model).State = EntityState.Modified;
                db.SaveChanges();
            }
        }