public List <ServerIPerf> GetServersList() { using (ServerIPerfContext db = new ServerIPerfContext()) { return(db.ServersIPerf.ToList()); } }
public int Count() { using (ServerIPerfContext db = new ServerIPerfContext()) { return(db.ServersIPerf.Count()); } }
public async Task SaveRange(IList <ServerIPerf> serversCollection) { using (ServerIPerfContext db = new ServerIPerfContext()) { db.ServersIPerf.AddRange(serversCollection); await db.SaveChangesAsync(); } }
public async Task SaveSingle(ServerIPerf sample) { using (ServerIPerfContext db = new ServerIPerfContext()) { await db.ServersIPerf.AddAsync(sample); await db.SaveChangesAsync(); } }
public async Task DeleteSingle(int id) { using (ServerIPerfContext db = new ServerIPerfContext()) { ServerIPerf deletingSample = await db.ServersIPerf.FindAsync(id); if (deletingSample != null) { db.ServersIPerf?.Remove(deletingSample); await db.SaveChangesAsync(); } } }
public async Task DeleteAll() { using (ServerIPerfContext db = new ServerIPerfContext()) { var histories = db.ServersIPerf; if (histories != null) { db.ServersIPerf?.RemoveRange(histories); await db.SaveChangesAsync(); } } }