Пример #1
0
        public static void Insert(AttributeGroup attributeGroup)
        {
            using (var db = OnlineStoreDbContext.Entity)
            {
                if (!db.Groups.Any(item => item.ParentID == attributeGroup.GroupID))
                {
                    db.AttributeGroups.Add(attributeGroup);

                    db.SaveChanges();
                }
            }
        }
Пример #2
0
        public static void Update(AttributeGroup attributeGroup)
        {
            using (var db = OnlineStoreDbContext.Entity)
            {
                var orgAttributeGroup = db.AttributeGroups.Where(item => item.ID == attributeGroup.ID).Single();

                orgAttributeGroup.GroupID     = attributeGroup.GroupID;
                orgAttributeGroup.AttributeID = attributeGroup.AttributeID;
                orgAttributeGroup.LastUpdate  = attributeGroup.LastUpdate;

                db.SaveChanges();
            }
        }