public virtual List <T> GetAll() { try { dbContext = new Mycontext(); return(dbContext.Set <T>().ToList()); } catch (Exception ex) { throw ex; } }
public virtual int Delete(T entity) { try { dbContext = dbContext ?? new Mycontext(); dbContext.Set <T>().Remove(entity); return(dbContext.SaveChanges()); } catch (Exception ex) { throw ex; } }
public virtual T GetById(TId id) { try { dbContext = new Mycontext(); return(dbContext.Set <T>().Find(id)); } catch (Exception ex) { throw ex; } }