public void SaveToDB() { using (var _db = new DataClasses1DataContext()) { try { var _item = _db.TItems.Single(x => x.id == this.id); _item.name = this.name; } catch { var _item = new TItem(); _item.name = this.name; _db.TItems.InsertOnSubmit(_item); } _db.SubmitChanges(); } }
public void DeleteFromDB() { using (var _db = new DataClasses1DataContext()) { TItem _item = new TItem() { id = this.id }; _db.TItems.Attach(_item); _db.TItems.DeleteOnSubmit(_item); _db.SubmitChanges(); } }
private void DeleteTItem(TItem obj) { this.TItemsDelete(((System.Nullable<System.Guid>)(obj.id))); }
partial void UpdateTItem(TItem instance);
private void InsertTItem(TItem obj) { this.TItemsInsert(obj.name); }