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