示例#1
0
 public List <ServerIPerf> GetServersList()
 {
     using (ServerIPerfContext db = new ServerIPerfContext())
     {
         return(db.ServersIPerf.ToList());
     }
 }
示例#2
0
 public int Count()
 {
     using (ServerIPerfContext db = new ServerIPerfContext())
     {
         return(db.ServersIPerf.Count());
     }
 }
示例#3
0
 public async Task SaveRange(IList <ServerIPerf> serversCollection)
 {
     using (ServerIPerfContext db = new ServerIPerfContext())
     {
         db.ServersIPerf.AddRange(serversCollection);
         await db.SaveChangesAsync();
     }
 }
示例#4
0
        public async Task SaveSingle(ServerIPerf sample)
        {
            using (ServerIPerfContext db = new ServerIPerfContext())
            {
                await db.ServersIPerf.AddAsync(sample);

                await db.SaveChangesAsync();
            }
        }
示例#5
0
        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();
                }
            }
        }
示例#6
0
        public async Task DeleteAll()
        {
            using (ServerIPerfContext db = new ServerIPerfContext())
            {
                var histories = db.ServersIPerf;

                if (histories != null)
                {
                    db.ServersIPerf?.RemoveRange(histories);
                    await db.SaveChangesAsync();
                }
            }
        }