oqtane.framework/Oqtane.Client/Services/InstallationService.cs
Pavel Vesely cf6643aef3 Client fixes
Client is partially done.
227 warnings left out of 1500
I like Rider
2020-03-15 15:19:35 +01:00

43 lines
1.3 KiB
C#

using Oqtane.Models;
using System.Threading.Tasks;
using System.Net.Http;
using Microsoft.AspNetCore.Components;
using Oqtane.Shared;
namespace Oqtane.Services
{
public class InstallationService : ServiceBase, IInstallationService
{
private readonly HttpClient _http;
private readonly SiteState _siteState;
private readonly NavigationManager _navigationManager;
public InstallationService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
{
_http = http;
_siteState = siteState;
_navigationManager = navigationManager;
}
private string Apiurl
{
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Installation"); }
}
public async Task<GenericResponse> IsInstalled()
{
return await _http.GetJsonAsync<GenericResponse>(Apiurl + "/installed");
}
public async Task<GenericResponse> Install(string connectionstring)
{
return await _http.PostJsonAsync<GenericResponse>(Apiurl, connectionstring);
}
public async Task<GenericResponse> Upgrade()
{
return await _http.GetJsonAsync<GenericResponse>(Apiurl + "/upgrade");
}
}
}