public void SetServiceStatus(IServiceEntry service, string status) { var existing = GetHistoryByServiceEntry(service); if (existing is null) { var historyRecord = new ServiceHistory { Id = Guid.NewGuid(), ServiceEntry = service, LastStatus = status }; _historyRecords.Add(historyRecord); } else { existing.LastStatus = status; } }
public void MarkServiceAlerted(IServiceEntry service) { var existing = GetHistoryByServiceEntry(service); if (existing is null) { var historyRecord = new ServiceHistory { Id = Guid.NewGuid(), ServiceEntry = service, LastAlert = DateTimeOffset.Now }; _historyRecords.Add(historyRecord); } else { existing.LastAlert = DateTimeOffset.Now; } }