public async Task MonitorAsync(IMonitoringObject aObject) { aObject.LastTime = DateTime.UtcNow; await _apiMonitoringObjectRepository.InsertAsync(aObject); await _monitoringObjectRepository.InsertAsync(aObject); }
public async Task CreateBackupAsync() { await _log.WriteInfoAsync("BackUpService", "CreateBackupAsync", "", "Creating a backup", DateTime.UtcNow); var all = await _monitoringObjectRepository.GetAllAsync(); var tasks = new List <Task>(all.Count()); foreach (var item in all) { var task = _apiMonitoringObjectRepository.InsertAsync(item); tasks.Add(task); } await Task.WhenAll(tasks); await _log.WriteInfoAsync("BackUpService", "CreateBackupAsync", "", "Backup has been created", DateTime.UtcNow); }