public void DeleteProperty(Guid id) { using (var db = new BL.ShopDataContext()) { var prop = db.ShopProperties.FirstOrDefault(p => p.ID == id); if (prop == null) return; db.ShopProperties.DeleteOnSubmit(prop); db.SubmitChanges(); } }
public void UpdateProperty(Guid id, string key, string value) { using (var db = new BL.ShopDataContext()) { var prop = db.ShopProperties.FirstOrDefault(p => p.ID == id); if (prop == null) return; prop.Key = key; prop.Value = value; db.SubmitChanges(); } }
public BL.ShopProperties AddProperty(string key, string value) { using (var db = new BL.ShopDataContext()) { var prop =new BL.ShopProperties() { ID= Guid.NewGuid(), Key = key, Value = value }; db.ShopProperties.InsertOnSubmit(prop); db.SubmitChanges(); return prop; } }