public ActionResult Index() { using (AppDb context = AppDb.Create()) { ViewBag.Networks = Networks.All(context); } return(View()); }
public static void UpdateNet() { using (AppDb context = AppDb.Create()) { lock (LastIp) { LastIp = new Dictionary <int, int>(); var n = Networks.All(context); foreach (Networks i in n) { LastIp.Add(i.Id, 0); } } } }
private void UpdateNetWorkIp(object obj) { lock (_net) { _net.Clear(); using (AppDb context = AppDb.Create()) { var nets = Networks.All(context); foreach (Networks s in nets) { _net[s.Id] = new List <IpWork>(); } List <IpNet> n = IpNet.All(context); foreach (IpNet i in n) { _net[nets.Select(m => m.Id).FirstOrDefault(m => m == i.NetWork)].Add(new IpWork(i.Ip, i.Aport, i.Tport)); } } } }