public virtual void Delete(T entity) { try { dbContext = dbContext ?? new MesajContext(); dbContext.Set <T>().Remove(entity); dbContext.SaveChanges(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public virtual void Insert(T entity) { try { dbContext = dbContext ?? new MesajContext(); dbContext.Set <T>().Add(entity); dbContext.SaveChanges(); } catch (Exception ex) { dbContext = new MesajContext(); throw new Exception(ex.Message); } }
public T GetByID(ID id) { dbContext = new MesajContext(); return(dbContext.Set <T>().Find(id)); }
public List <T> GetALL() { dbContext = new MesajContext(); return(dbContext.Set <T>().ToList()); }