示例#1
0
 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);
     }
 }
示例#2
0
 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);
     }
 }
示例#3
0
 public T GetByID(ID id)
 {
     dbContext = new MesajContext();
     return(dbContext.Set <T>().Find(id));
 }
示例#4
0
 public List <T> GetALL()
 {
     dbContext = new MesajContext();
     return(dbContext.Set <T>().ToList());
 }