public static async Task <bool> Insert(MonitorResultBO item) { IMongoCollection <MonitorResultBO> collection = database.GetCollection <MonitorResultBO>("Monitor"); await collection.InsertOneAsync(item); return(true); }
public static void InsertResults(List <ClusterBO> clustersLife) { foreach (ClusterBO cluster in clustersLife) { foreach (MonitorBO monitor in cluster.Monitors) { foreach (NodeBO node in monitor.Nodes) { MonitorResultBO res = new MonitorResultBO() { ApplicationCode = monitor.ApplicationCode, ApplicationName = monitor.ApplicationName, Environment = cluster.Environment, MachineName = node.MachineName, Result = node.LifeResult, ResultDate = DateTime.Now }; bool ret = MonitorDal.Insert(res).Result; } } } }