public void Insert(Clientes clientes) { try { using (SGCCContext c = new SGCCContext()) { c.Clientes.Add(clientes); c.SaveChanges(); } } catch (Exception ex) { throw new Exception(ex.ToString()); } }
public void Update(Clientes clientes) { try { using (SGCCContext c = new SGCCContext()) { c.Entry(clientes).State = EntityState.Modified; c.SaveChanges(); } } catch (Exception ex) { throw new Exception(ex.ToString()); } }
public void delete(int id) { try { using (SGCCContext c = new SGCCContext()) { c.Clientes.Remove(c.Clientes.Find(id)); c.SaveChanges(); } } catch (Exception ex) { throw new Exception(ex.ToString()); } }