Пример #1
0
 public virtual List <T> GetAll()
 {
     try
     {
         dbContext = new Mycontext();
         return(dbContext.Set <T>().ToList());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #2
0
 public virtual int Delete(T entity)
 {
     try
     {
         dbContext = dbContext ?? new Mycontext();
         dbContext.Set <T>().Remove(entity);
         return(dbContext.SaveChanges());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #3
0
        public virtual T GetById(TId id)
        {
            try
            {
                dbContext = new Mycontext();

                return(dbContext.Set <T>().Find(id));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }