2017-03-23 19:10:55 +01:00
|
|
|
|
using Microsoft.Extensions.HealthChecks;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace WebStatus.Viewmodels
|
|
|
|
|
{
|
|
|
|
|
public class HealthStatusViewModel
|
|
|
|
|
{
|
|
|
|
|
private readonly CheckStatus _overall;
|
2017-03-31 12:47:56 +02:00
|
|
|
|
private readonly Dictionary<string, IHealthCheckResult> _results;
|
2017-03-23 19:10:55 +01:00
|
|
|
|
|
|
|
|
|
public CheckStatus OverallStatus => _overall;
|
2017-03-31 12:47:56 +02:00
|
|
|
|
public IEnumerable<NamedCheckResult> Results => _results.Select(kvp => new NamedCheckResult(kvp.Key, kvp.Value));
|
|
|
|
|
private HealthStatusViewModel() => _results = new Dictionary<string, IHealthCheckResult>();
|
2017-03-23 19:10:55 +01:00
|
|
|
|
public HealthStatusViewModel(CheckStatus overall) : this() => _overall = overall;
|
2017-03-31 12:47:56 +02:00
|
|
|
|
public void AddResult(string name, IHealthCheckResult result) => _results.Add(name, result);
|
2017-03-23 19:10:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|