Exemple #1
0
 public virtual bool DeleteData(int id)
 {
     using (var _LMContext = new LMContext())
     {
         var designation = _LMContext.Set <T>().Find(id);
         _LMContext.Entry(designation).State = System.Data.Entity.EntityState.Modified;
         _LMContext.Set <T>().Remove(designation);
         return(_LMContext.SaveChanges() > 0);
     }
 }
Exemple #2
0
 public virtual List <T> GetAllData()
 {
     using (var _LMContext = new LMContext())
     {
         return(_LMContext.Set <T>().ToList());
     }
 }
Exemple #3
0
 public virtual T GetDataById(int id)
 {
     using (var _LMContext = new LMContext())
     {
         return(_LMContext.Set <T>().Find(id));
     }
 }
Exemple #4
0
 public virtual int TotalRowCount()
 {
     using (var _LMContext = new LMContext())
     {
         return(_LMContext.Set <T>().Count());
     }
 }
Exemple #5
0
 public virtual bool SaveData(T model)
 {
     using (var _LMContext = new LMContext())
     {
         _LMContext.Set <T>().Add(model);
         return(_LMContext.SaveChanges() > 0);
     }
 }