public void Update(TEntity parameter) { using (var context = new HSERPEntities(_connectString)) { try { context.Set <TEntity>().Attach(parameter); context.Entry(parameter).State = EntityState.Modified; context.SaveChanges(); } catch (Exception e) { Debug.WriteLine(e.Message); } } }
public TEntity Insert(TEntity parameter) { using (var context = new HSERPEntities(_connectString)) { try { var para = context.Set <TEntity>().Add(parameter); context.SaveChanges(); return(para); } catch (DbUpdateException e) { Console.WriteLine(e.InnerException.Message); return(null); } } }
public void Insert(List <TEntity> parameters) { using (var context = new HSERPEntities(_connectString)) { try { foreach (var info in parameters) { context.Set <TEntity>().Add(info); } context.SaveChanges(); } catch (DbUpdateException e) { Console.WriteLine(e.InnerException.Message); } } }
public void Update(List <TEntity> parameters) { using (var context = new HSERPEntities(_connectString)) { try { foreach (var info in parameters) { context.Set <TEntity>().Attach(info); context.Entry(info).State = EntityState.Modified; } context.SaveChanges(); } catch (Exception e) { Debug.WriteLine(e.Message); } } }
public void Save(HSERPEntities context) { context.SaveChanges(); }
private void Save(HSERPEntities context) { context.SaveChanges(); }