コード例 #1
0
        public void SaveAgency(Agency agency)
        {
            // if it's a new agency, just attach it to the DataContext
            if (agency.Id == 0)
                agenciesTable.InsertOnSubmit(agency);
            else if (agenciesTable.GetOriginalEntityState(agency) == null)
            {
                // We;'re updating an existing product, but it's not attached to this DataContext,
                // so attach it and detect changes
                agenciesTable.Attach(agency);
                agenciesTable.Context.Refresh(RefreshMode.KeepCurrentValues, agency);
            }

            agenciesTable.Context.SubmitChanges();
        }
コード例 #2
0
 public void DeleteAgency(Agency agency)
 {
     agenciesTable.DeleteOnSubmit(agency);
     agenciesTable.Context.SubmitChanges();
 }