33 lines
1013 B
C#
33 lines
1013 B
C#
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
using ListmonkIntegration.Services;
|
|
using ListmonkIntegration.Models;
|
|
using Microsoft.Extensions.Options;
|
|
|
|
namespace ListmonkIntegration.Pages
|
|
{
|
|
public class IndexModel : PageModel
|
|
{
|
|
private readonly ILogger<IndexModel> _logger;
|
|
private readonly IListmonkService _listmonkService;
|
|
private readonly ListmonkSettings _settings;
|
|
|
|
public bool IsConnected { get; private set; }
|
|
public string ListmonkUrl { get; private set; } = string.Empty;
|
|
|
|
public IndexModel(
|
|
ILogger<IndexModel> logger,
|
|
IListmonkService listmonkService,
|
|
IOptions<ListmonkSettings> settings)
|
|
{
|
|
_logger = logger;
|
|
_listmonkService = listmonkService;
|
|
_settings = settings.Value;
|
|
}
|
|
|
|
public async Task OnGetAsync()
|
|
{
|
|
ListmonkUrl = _settings.BaseUrl;
|
|
IsConnected = await _listmonkService.TestConnectionAsync();
|
|
}
|
|
}
|
|
} |