public void InsertOrUpdate(Client client)
 {
     if (client.ID == 0)
     {
         _db.Clients.Add(client);
     }
     else
     {
         _db.Entry(client).State = EntityState.Modified;
     }
 }
Example #2
0
 public void InsertOrUpdate(Source source)
 {
     // new Source record
     if (source.ID == 0)
     {
         _db.Sources.Add(source);
     }
     else
     {
         _db.Entry(source).State = EntityState.Modified;
     }
 }
Example #3
0
 public void InsertOrUpdate(PromoCode promoCode)
 {
     // new PromoCode record
     if (promoCode.ID == 0)
     {
         _db.PromoCodes.Add(promoCode);
     }
     else
     {
         _db.Entry(promoCode).State = EntityState.Modified;
     }
 }
 //
 // Insert / Delete Methods
 public void InsertOrUpdate(Contact contact)
 {
     if (contact.ID == 0)
     {
         // New contact record
         _db.Contacts.Add(contact);
     }
     else
     {
         // Existing contact record
         _db.Entry(contact).State = EntityState.Modified;
     }
 }