public async void InsertNode(NodeDetails node) { try { using (var context = new SqlDataModel(_connectionString)) { context.NodeDetails.Add(node); await context.SaveChangesAsync(); } } catch (Exception ex) { _log.Error(ex); } }
public async void InsertMaster(MasterDetails master) { try { using (var context = new SqlDataModel(_connectionString)) { context.MasterDetail.Add(master); await context.SaveChangesAsync(); } } catch (Exception ex) { _log.Error(ex); } }
public List <NodeDetails> GetLiveNodes() { List <NodeDetails> nodes = null; try { using (var context = new SqlDataModel(_connectionString)) { nodes = context.NodeDetails.Where(n => n.IsAlive).ToList(); } } catch (Exception ex) { _log.Error(ex); } return(nodes); }
public MasterDetails GetLiveMasterDetails() { MasterDetails master = null; try { using (var context = new SqlDataModel(_connectionString)) { master = context.MasterDetail.FirstOrDefault(m => m.IsAlive); } } catch (Exception ex) { _log.Error(ex); } return(master); }
public async void DeclareNodeDead(NodeDetails node) { try { using (var context = new SqlDataModel(_connectionString)) { node.IsAlive = false; node.DeadDeclairedDate = DateTime.UtcNow.ToShortTimeString(); context.NodeDetails.Add(node); await context.SaveChangesAsync(); } } catch (Exception ex) { _log.Error(ex); } }
public NodeDetails GetNode(string nodeId) { NodeDetails node = null; try { using (var context = new SqlDataModel(_connectionString)) { node = context.NodeDetails.FirstOrDefault(n => n.IsAlive); } } catch (Exception ex) { _log.Error(ex); } return(node); }