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); } } }
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); } } }