public object Delete(E entity) { try { using (var contexto = new DB_DACSEntities()) { contexto.Set <E>().Attach(entity); result = contexto.Set <E>().Remove(entity); contexto.SaveChanges(); } return(result); } catch (Exception ex) { throw ex; } }
public object Read() { try { using (var contexto = new DB_DACSEntities()) { contexto.Configuration.LazyLoadingEnabled = false; listaResult = contexto.Set <E>().ToList <E>(); } return(listaResult); } catch (Exception ex) { throw ex; } }
//public object Create(E entity) public E Create(E entity) { try { using (var contexto = new DB_DACSEntities()) { contexto.Configuration.LazyLoadingEnabled = false; result = contexto.Set <E>().Add(entity); contexto.SaveChanges(); } return(result); } catch (Exception ex) { throw ex; } }