예제 #1
0
 public void Delete(int id)
 {
     using (Core.DBHelper.DBContext dbContext = new Core.DBHelper.DBContext())
     {
         try
         {
             var SilinecekModel = dbContext.Set <Sirket>().FirstOrDefault(x => x.sirketID == id);
             dbContext.Set <Sirket>().Remove(SilinecekModel);
             dbContext.SaveChanges();
         }
         catch (Exception ex)
         {
             throw new Exception(ex.Message);
         }
     }
 }
예제 #2
0
 public bool Add(Sirket model)
 {
     using (Core.DBHelper.DBContext dbContext = new Core.DBHelper.DBContext())
     {
         try
         {
             dbContext.Set <Sirket>().Add(model);
             dbContext.SaveChanges();
             return(true);
         }
         catch (Exception ex)
         {
             throw new Exception(ex.Message);
         }
     }
 }