public List <Sirket> Get() { using (Core.DBHelper.DBContext dbContext = new Core.DBHelper.DBContext()) { DbSet <Sirket> table = dbContext.Set <Sirket>(); return(table.Include(x => x.Kullanici).Include(x => x.Arac).Include(x => x.İl).ToList()); } }
public List <Arac> Get() { using (Core.DBHelper.DBContext dbContext = new Core.DBHelper.DBContext()) { try { DbSet <Arac> table = dbContext.Set <Arac>(); return(table.Include(x => x.Sirket).ToList()); } catch (Exception ex) { throw new Exception(ex.Message); } } }
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); } } }