Migration to using System.Net.Http.Json; part one - functional migration
This commit is contained in:
parent
fe2ad29b3b
commit
95e9bee4e2
|
@ -11,13 +11,13 @@ namespace Oqtane.Modules.HtmlText.Services
|
||||||
{
|
{
|
||||||
public class HtmlTextService : ServiceBase, IHtmlTextService
|
public class HtmlTextService : ServiceBase, IHtmlTextService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
|
|
||||||
public HtmlTextService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public HtmlTextService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ namespace Oqtane.Modules.HtmlText.Services
|
||||||
{
|
{
|
||||||
//because GetJsonAsync() returns an error if no content exists for the ModuleId ( https://github.com/aspnet/AspNetCore/issues/14041 )
|
//because GetJsonAsync() returns an error if no content exists for the ModuleId ( https://github.com/aspnet/AspNetCore/issues/14041 )
|
||||||
//null value is transfered as empty list
|
//null value is transfered as empty list
|
||||||
var htmlTextList = await _http.GetJsonAsync<List<HtmlTextInfo>>(ApiUrl + "/" + moduleId + "?entityid=" + moduleId);
|
var htmlTextList = await GetJsonAsync<List<HtmlTextInfo>>(ApiUrl + "/" + moduleId + "?entityid=" + moduleId);
|
||||||
htmlText = htmlTextList.FirstOrDefault();
|
htmlText = htmlTextList.FirstOrDefault();
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
@ -44,17 +44,18 @@ namespace Oqtane.Modules.HtmlText.Services
|
||||||
|
|
||||||
public async Task AddHtmlTextAsync(HtmlTextInfo htmlText)
|
public async Task AddHtmlTextAsync(HtmlTextInfo htmlText)
|
||||||
{
|
{
|
||||||
await _http.PostJsonAsync(ApiUrl + "?entityid=" + htmlText.ModuleId, htmlText);
|
await PostJsonAsync(ApiUrl + "?entityid=" + htmlText.ModuleId, htmlText);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdateHtmlTextAsync(HtmlTextInfo htmlText)
|
public async Task UpdateHtmlTextAsync(HtmlTextInfo htmlText)
|
||||||
{
|
{
|
||||||
await _http.PutJsonAsync(ApiUrl + "/" + htmlText.HtmlTextId + "?entityid=" + htmlText.ModuleId, htmlText);
|
await PutJsonAsync(ApiUrl + "/" + htmlText.HtmlTextId + "?entityid=" + htmlText.ModuleId, htmlText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task DeleteHtmlTextAsync(int moduleId)
|
public async Task DeleteHtmlTextAsync(int moduleId)
|
||||||
{
|
{
|
||||||
await _http.DeleteAsync(ApiUrl + "/" + moduleId + "?entityid=" + moduleId);
|
await DeleteAsync(ApiUrl + "/" + moduleId + "?entityid=" + moduleId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.0-preview3.20168.3" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.0-preview3.20168.3" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.0-preview3.20168.3" PrivateAssets="all" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.0-preview3.20168.3" PrivateAssets="all" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.2.0-preview3.20168.3" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="3.1.2" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="3.1.2" />
|
||||||
|
<PackageReference Include="System.Net.Http.Json" Version="3.2.0-preview3.20175.8" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using System.Net.Http.Json;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
@ -29,7 +30,7 @@ namespace Oqtane.Providers
|
||||||
// get HttpClient lazily from IServiceProvider as you cannot use standard dependency injection due to the AuthenticationStateProvider being initialized prior to NavigationManager ( https://github.com/aspnet/AspNetCore/issues/11867 )
|
// get HttpClient lazily from IServiceProvider as you cannot use standard dependency injection due to the AuthenticationStateProvider being initialized prior to NavigationManager ( https://github.com/aspnet/AspNetCore/issues/11867 )
|
||||||
var http = _serviceProvider.GetRequiredService<HttpClient>();
|
var http = _serviceProvider.GetRequiredService<HttpClient>();
|
||||||
string apiurl = ServiceBase.CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "User") + "/authenticate";
|
string apiurl = ServiceBase.CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "User") + "/authenticate";
|
||||||
User user = await http.GetJsonAsync<User>(apiurl);
|
User user = await http.GetFromJsonAsync<User>(apiurl);
|
||||||
|
|
||||||
ClaimsIdentity identity = new ClaimsIdentity();
|
ClaimsIdentity identity = new ClaimsIdentity();
|
||||||
if (user.IsAuthenticated)
|
if (user.IsAuthenticated)
|
||||||
|
|
|
@ -2,23 +2,24 @@
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNetCore.Components;
|
//using Microsoft.AspNetCore.Components;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Net.Http.Json;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
namespace Oqtane.Services
|
namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class AliasService : ServiceBase, IAliasService
|
public class AliasService : ServiceBase, IAliasService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
|
||||||
public AliasService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public AliasService(HttpClient http, SiteState siteState, NavigationManager navigationManager) :base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
}
|
}
|
||||||
|
@ -30,13 +31,13 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<List<Alias>> GetAliasesAsync()
|
public async Task<List<Alias>> GetAliasesAsync()
|
||||||
{
|
{
|
||||||
List<Alias> aliases = await _http.GetJsonAsync<List<Alias>>(Apiurl);
|
List<Alias> aliases = await GetJsonAsync<List<Alias>>(Apiurl);
|
||||||
return aliases.OrderBy(item => item.Name).ToList();
|
return aliases.OrderBy(item => item.Name).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Alias> GetAliasAsync(int aliasId)
|
public async Task<Alias> GetAliasAsync(int aliasId)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<Alias>($"{Apiurl}/{aliasId.ToString()}");
|
return await GetJsonAsync<Alias>($"{Apiurl}/{aliasId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Alias> GetAliasAsync(string url, DateTime lastSyncDate)
|
public async Task<Alias> GetAliasAsync(string url, DateTime lastSyncDate)
|
||||||
|
@ -51,21 +52,21 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
name = name.Substring(0, name.Length - 1);
|
name = name.Substring(0, name.Length - 1);
|
||||||
}
|
}
|
||||||
return await _http.GetJsonAsync<Alias>($"{Apiurl}/name/{WebUtility.UrlEncode(name)}?lastsyncdate={lastSyncDate.ToString("yyyyMMddHHmmssfff")}");
|
return await GetJsonAsync<Alias>($"{Apiurl}/name/{WebUtility.UrlEncode(name)}?lastsyncdate={lastSyncDate.ToString("yyyyMMddHHmmssfff")}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Alias> AddAliasAsync(Alias alias)
|
public async Task<Alias> AddAliasAsync(Alias alias)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<Alias>(Apiurl, alias);
|
return await PostJsonAsync<Alias>(Apiurl, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Alias> UpdateAliasAsync(Alias alias)
|
public async Task<Alias> UpdateAliasAsync(Alias alias)
|
||||||
{
|
{
|
||||||
return await _http.PutJsonAsync<Alias>($"{Apiurl}/{alias.AliasId.ToString()}", alias);
|
return await PutJsonAsync<Alias>($"{Apiurl}/{alias.AliasId.ToString()}", alias);
|
||||||
}
|
}
|
||||||
public async Task DeleteAliasAsync(int aliasId)
|
public async Task DeleteAliasAsync(int aliasId)
|
||||||
{
|
{
|
||||||
await _http.DeleteAsync($"{Apiurl}/{aliasId.ToString()}");
|
await DeleteAsync($"{Apiurl}/{aliasId.ToString()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,15 +13,13 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class FileService : ServiceBase, IFileService
|
public class FileService : ServiceBase, IFileService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
private readonly IJSRuntime _jsRuntime;
|
private readonly IJSRuntime _jsRuntime;
|
||||||
|
|
||||||
public FileService(HttpClient http, SiteState siteState, NavigationManager navigationManager,
|
public FileService(HttpClient http, SiteState siteState, NavigationManager navigationManager,
|
||||||
IJSRuntime jsRuntime)
|
IJSRuntime jsRuntime) : base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
_jsRuntime = jsRuntime;
|
_jsRuntime = jsRuntime;
|
||||||
|
@ -39,7 +37,7 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<List<File>> GetFilesAsync(string folder)
|
public async Task<List<File>> GetFilesAsync(string folder)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<List<File>>($"{Apiurl}?folder={folder}");
|
return await GetJsonAsync<List<File>>($"{Apiurl}?folder={folder}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<File>> GetFilesAsync(int siteId, string folderPath)
|
public async Task<List<File>> GetFilesAsync(int siteId, string folderPath)
|
||||||
|
@ -51,39 +49,32 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
var path = WebUtility.UrlEncode(folderPath);
|
var path = WebUtility.UrlEncode(folderPath);
|
||||||
|
|
||||||
return await _http.GetJsonAsync<List<File>>($"{Apiurl}/{siteId}/{path}");
|
return await GetJsonAsync<List<File>>($"{Apiurl}/{siteId}/{path}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<File> GetFileAsync(int fileId)
|
public async Task<File> GetFileAsync(int fileId)
|
||||||
{
|
{
|
||||||
try
|
return await GetJsonAsync<File>($"{Apiurl}/{fileId.ToString()}");
|
||||||
{
|
|
||||||
return await _http.GetJsonAsync<File>($"{Apiurl}/{fileId.ToString()}");
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<File> AddFileAsync(File file)
|
public async Task<File> AddFileAsync(File file)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<File>(Apiurl, file);
|
return await PostJsonAsync<File>(Apiurl, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<File> UpdateFileAsync(File file)
|
public async Task<File> UpdateFileAsync(File file)
|
||||||
{
|
{
|
||||||
return await _http.PutJsonAsync<File>($"{Apiurl}/{file.FileId.ToString()}", file);
|
return await PutJsonAsync<File>($"{Apiurl}/{file.FileId.ToString()}", file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteFileAsync(int fileId)
|
public async Task DeleteFileAsync(int fileId)
|
||||||
{
|
{
|
||||||
await _http.DeleteAsync($"{Apiurl}/{fileId.ToString()}");
|
await DeleteAsync($"{Apiurl}/{fileId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<File> UploadFileAsync(string url, int folderId)
|
public async Task<File> UploadFileAsync(string url, int folderId)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<File>($"{Apiurl}/upload?url={WebUtility.UrlEncode(url)}&folderid={folderId.ToString()}");
|
return await GetJsonAsync<File>($"{Apiurl}/upload?url={WebUtility.UrlEncode(url)}&folderid={folderId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<string> UploadFilesAsync(int folderId, string[] files, string id)
|
public async Task<string> UploadFilesAsync(int folderId, string[] files, string id)
|
||||||
|
@ -133,7 +124,7 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<byte[]> DownloadFileAsync(int fileId)
|
public async Task<byte[]> DownloadFileAsync(int fileId)
|
||||||
{
|
{
|
||||||
return await _http.GetByteArrayAsync($"{Apiurl}/download/{fileId.ToString()}");
|
return await GetByteArrayAsync($"{Apiurl}/download/{fileId.ToString()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,13 +13,11 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class FolderService : ServiceBase, IFolderService
|
public class FolderService : ServiceBase, IFolderService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
|
||||||
public FolderService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public FolderService(HttpClient http, SiteState siteState, NavigationManager navigationManager):base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
}
|
}
|
||||||
|
@ -28,14 +26,14 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<List<Folder>> GetFoldersAsync(int siteId)
|
public async Task<List<Folder>> GetFoldersAsync(int siteId)
|
||||||
{
|
{
|
||||||
List<Folder> folders = await _http.GetJsonAsync<List<Folder>>($"{ApiUrl}?siteid={siteId.ToString()}");
|
List<Folder> folders = await GetJsonAsync<List<Folder>>($"{ApiUrl}?siteid={siteId.ToString()}");
|
||||||
folders = GetFoldersHierarchy(folders);
|
folders = GetFoldersHierarchy(folders);
|
||||||
return folders;
|
return folders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Folder> GetFolderAsync(int folderId)
|
public async Task<Folder> GetFolderAsync(int folderId)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<Folder>($"{ApiUrl}/{folderId.ToString()}");
|
return await GetJsonAsync<Folder>($"{ApiUrl}/{folderId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Folder> GetFolderAsync(int siteId, [NotNull] string folderPath)
|
public async Task<Folder> GetFolderAsync(int siteId, [NotNull] string folderPath)
|
||||||
|
@ -47,17 +45,17 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
var path = WebUtility.UrlEncode(folderPath);
|
var path = WebUtility.UrlEncode(folderPath);
|
||||||
|
|
||||||
return await _http.GetJsonAsync<Folder>($"{ApiUrl}/{siteId}/{path}");
|
return await GetJsonAsync<Folder>($"{ApiUrl}/{siteId}/{path}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Folder> AddFolderAsync(Folder folder)
|
public async Task<Folder> AddFolderAsync(Folder folder)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<Folder>(ApiUrl, folder);
|
return await PostJsonAsync<Folder>(ApiUrl, folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Folder> UpdateFolderAsync(Folder folder)
|
public async Task<Folder> UpdateFolderAsync(Folder folder)
|
||||||
{
|
{
|
||||||
return await _http.PutJsonAsync<Folder>($"{ApiUrl}/{folder.FolderId.ToString()}", folder);
|
return await PutJsonAsync<Folder>($"{ApiUrl}/{folder.FolderId.ToString()}", folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdateFolderOrderAsync(int siteId, int folderId, int? parentId)
|
public async Task UpdateFolderOrderAsync(int siteId, int folderId, int? parentId)
|
||||||
|
@ -65,12 +63,12 @@ namespace Oqtane.Services
|
||||||
var parent = parentId == null
|
var parent = parentId == null
|
||||||
? string.Empty
|
? string.Empty
|
||||||
: parentId.ToString();
|
: parentId.ToString();
|
||||||
await _http.PutJsonAsync($"{ApiUrl}/?siteid={siteId.ToString()}&folderid={folderId.ToString()}&parentid={parent}", null);
|
await PutAsync($"{ApiUrl}/?siteid={siteId.ToString()}&folderid={folderId.ToString()}&parentid={parent}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteFolderAsync(int folderId)
|
public async Task DeleteFolderAsync(int folderId)
|
||||||
{
|
{
|
||||||
await _http.DeleteAsync($"{ApiUrl}/{folderId.ToString()}");
|
await DeleteAsync($"{ApiUrl}/{folderId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Folder> GetFoldersHierarchy(List<Folder> folders)
|
private static List<Folder> GetFoldersHierarchy(List<Folder> folders)
|
||||||
|
|
|
@ -8,13 +8,11 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class InstallationService : ServiceBase, IInstallationService
|
public class InstallationService : ServiceBase, IInstallationService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
|
||||||
public InstallationService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public InstallationService(HttpClient http, SiteState siteState, NavigationManager navigationManager):base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
}
|
}
|
||||||
|
@ -23,17 +21,17 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<Installation> IsInstalled()
|
public async Task<Installation> IsInstalled()
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<Installation>($"{ApiUrl}/installed");
|
return await GetJsonAsync<Installation>($"{ApiUrl}/installed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Installation> Install(InstallConfig config)
|
public async Task<Installation> Install(InstallConfig config)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<Installation>(ApiUrl, config);
|
return await PostJsonAsync<InstallConfig,Installation>(ApiUrl, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Installation> Upgrade()
|
public async Task<Installation> Upgrade()
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<Installation>($"{ApiUrl}/upgrade");
|
return await GetJsonAsync<Installation>($"{ApiUrl}/upgrade");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,12 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class JobLogService : ServiceBase, IJobLogService
|
public class JobLogService : ServiceBase, IJobLogService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
|
||||||
public JobLogService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public JobLogService(HttpClient http, SiteState siteState, NavigationManager navigationManager) :base(http)
|
||||||
|
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
}
|
}
|
||||||
|
@ -28,27 +27,27 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<List<JobLog>> GetJobLogsAsync()
|
public async Task<List<JobLog>> GetJobLogsAsync()
|
||||||
{
|
{
|
||||||
List<JobLog> joblogs = await _http.GetJsonAsync<List<JobLog>>(Apiurl);
|
List<JobLog> joblogs = await GetJsonAsync<List<JobLog>>(Apiurl);
|
||||||
return joblogs.OrderBy(item => item.StartDate).ToList();
|
return joblogs.OrderBy(item => item.StartDate).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<JobLog> GetJobLogAsync(int jobLogId)
|
public async Task<JobLog> GetJobLogAsync(int jobLogId)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<JobLog>($"{Apiurl}/{jobLogId.ToString()}");
|
return await GetJsonAsync<JobLog>($"{Apiurl}/{jobLogId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<JobLog> AddJobLogAsync(JobLog joblog)
|
public async Task<JobLog> AddJobLogAsync(JobLog joblog)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<JobLog>(Apiurl, joblog);
|
return await PostJsonAsync<JobLog>(Apiurl, joblog);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<JobLog> UpdateJobLogAsync(JobLog joblog)
|
public async Task<JobLog> UpdateJobLogAsync(JobLog joblog)
|
||||||
{
|
{
|
||||||
return await _http.PutJsonAsync<JobLog>($"{Apiurl}/{joblog.JobLogId.ToString()}", joblog);
|
return await PutJsonAsync<JobLog>($"{Apiurl}/{joblog.JobLogId.ToString()}", joblog);
|
||||||
}
|
}
|
||||||
public async Task DeleteJobLogAsync(int jobLogId)
|
public async Task DeleteJobLogAsync(int jobLogId)
|
||||||
{
|
{
|
||||||
await _http.DeleteAsync($"{Apiurl}/{jobLogId.ToString()}");
|
await DeleteAsync($"{Apiurl}/{jobLogId.ToString()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,13 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class JobService : ServiceBase, IJobService
|
public class JobService : ServiceBase, IJobService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
|
||||||
public JobService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public JobService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
}
|
}
|
||||||
|
@ -28,37 +28,37 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<List<Job>> GetJobsAsync()
|
public async Task<List<Job>> GetJobsAsync()
|
||||||
{
|
{
|
||||||
List<Job> jobs = await _http.GetJsonAsync<List<Job>>(Apiurl);
|
List<Job> jobs = await GetJsonAsync<List<Job>>(Apiurl);
|
||||||
return jobs.OrderBy(item => item.Name).ToList();
|
return jobs.OrderBy(item => item.Name).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Job> GetJobAsync(int jobId)
|
public async Task<Job> GetJobAsync(int jobId)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<Job>($"{Apiurl}/{jobId.ToString()}");
|
return await GetJsonAsync<Job>($"{Apiurl}/{jobId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Job> AddJobAsync(Job job)
|
public async Task<Job> AddJobAsync(Job job)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<Job>(Apiurl, job);
|
return await PostJsonAsync<Job>(Apiurl, job);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Job> UpdateJobAsync(Job job)
|
public async Task<Job> UpdateJobAsync(Job job)
|
||||||
{
|
{
|
||||||
return await _http.PutJsonAsync<Job>($"{Apiurl}/{job.JobId.ToString()}", job);
|
return await PutJsonAsync<Job>($"{Apiurl}/{job.JobId.ToString()}", job);
|
||||||
}
|
}
|
||||||
public async Task DeleteJobAsync(int jobId)
|
public async Task DeleteJobAsync(int jobId)
|
||||||
{
|
{
|
||||||
await _http.DeleteAsync($"{Apiurl}/{jobId.ToString()}");
|
await DeleteAsync($"{Apiurl}/{jobId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task StartJobAsync(int jobId)
|
public async Task StartJobAsync(int jobId)
|
||||||
{
|
{
|
||||||
await _http.GetAsync($"{Apiurl}/start/{jobId.ToString()}");
|
await GetAsync($"{Apiurl}/start/{jobId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task StopJobAsync(int jobId)
|
public async Task StopJobAsync(int jobId)
|
||||||
{
|
{
|
||||||
await _http.GetAsync($"{Apiurl}/stop/{jobId.ToString()}");
|
await GetAsync($"{Apiurl}/stop/{jobId.ToString()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,13 +12,13 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class LogService : ServiceBase, ILogService
|
public class LogService : ServiceBase, ILogService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
|
||||||
public LogService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public LogService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
}
|
}
|
||||||
|
@ -30,12 +30,12 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<List<Log>> GetLogsAsync(int siteId, string level, string function, int rows)
|
public async Task<List<Log>> GetLogsAsync(int siteId, string level, string function, int rows)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<List<Log>>($"{Apiurl}?siteid={siteId.ToString()}&level={level}&function={function}&rows={rows.ToString()}");
|
return await GetJsonAsync<List<Log>>($"{Apiurl}?siteid={siteId.ToString()}&level={level}&function={function}&rows={rows.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Log> GetLogAsync(int logId)
|
public async Task<Log> GetLogAsync(int logId)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<Log>($"{Apiurl}/{logId.ToString()}");
|
return await GetJsonAsync<Log>($"{Apiurl}/{logId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Log(int? pageId, int? moduleId, int? userId, string category, string feature, LogFunction function, LogLevel level, Exception exception, string message, params object[] args)
|
public async Task Log(int? pageId, int? moduleId, int? userId, string category, string feature, LogFunction function, LogLevel level, Exception exception, string message, params object[] args)
|
||||||
|
@ -69,7 +69,7 @@ namespace Oqtane.Services
|
||||||
log.Message = message;
|
log.Message = message;
|
||||||
log.MessageTemplate = "";
|
log.MessageTemplate = "";
|
||||||
log.Properties = JsonSerializer.Serialize(args);
|
log.Properties = JsonSerializer.Serialize(args);
|
||||||
await _http.PostJsonAsync(CreateCrossTenantUrl(Apiurl, alias), log);
|
await PostJsonAsync(CreateCrossTenantUrl(Apiurl, alias), log);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace Oqtane.Services
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
|
||||||
public ModuleDefinitionService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public ModuleDefinitionService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
_http = http;
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
|
@ -31,28 +31,28 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<List<ModuleDefinition>> GetModuleDefinitionsAsync(int siteId)
|
public async Task<List<ModuleDefinition>> GetModuleDefinitionsAsync(int siteId)
|
||||||
{
|
{
|
||||||
List<ModuleDefinition> moduledefinitions = await _http.GetJsonAsync<List<ModuleDefinition>>($"{Apiurl}?siteid={siteId.ToString()}");
|
List<ModuleDefinition> moduledefinitions = await GetJsonAsync<List<ModuleDefinition>>($"{Apiurl}?siteid={siteId.ToString()}");
|
||||||
return moduledefinitions.OrderBy(item => item.Name).ToList();
|
return moduledefinitions.OrderBy(item => item.Name).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ModuleDefinition> GetModuleDefinitionAsync(int moduleDefinitionId, int siteId)
|
public async Task<ModuleDefinition> GetModuleDefinitionAsync(int moduleDefinitionId, int siteId)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<ModuleDefinition>($"{Apiurl}/{moduleDefinitionId.ToString()}?siteid={siteId.ToString()}");
|
return await GetJsonAsync<ModuleDefinition>($"{Apiurl}/{moduleDefinitionId.ToString()}?siteid={siteId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdateModuleDefinitionAsync(ModuleDefinition moduleDefinition)
|
public async Task UpdateModuleDefinitionAsync(ModuleDefinition moduleDefinition)
|
||||||
{
|
{
|
||||||
await _http.PutJsonAsync($"{Apiurl}/{moduleDefinition.ModuleDefinitionId.ToString()}", moduleDefinition);
|
await PutJsonAsync($"{Apiurl}/{moduleDefinition.ModuleDefinitionId.ToString()}", moduleDefinition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task InstallModuleDefinitionsAsync()
|
public async Task InstallModuleDefinitionsAsync()
|
||||||
{
|
{
|
||||||
await _http.GetJsonAsync<List<string>>($"{Apiurl}/install");
|
await GetJsonAsync<List<string>>($"{Apiurl}/install");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteModuleDefinitionAsync(int moduleDefinitionId, int siteId)
|
public async Task DeleteModuleDefinitionAsync(int moduleDefinitionId, int siteId)
|
||||||
{
|
{
|
||||||
await _http.DeleteAsync($"{Apiurl}/{moduleDefinitionId.ToString()}?siteid={siteId.ToString()}");
|
await DeleteAsync($"{Apiurl}/{moduleDefinitionId.ToString()}?siteid={siteId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task LoadModuleDefinitionsAsync(int siteId, Runtime runtime)
|
public async Task LoadModuleDefinitionsAsync(int siteId, Runtime runtime)
|
||||||
|
@ -94,7 +94,7 @@ namespace Oqtane.Services
|
||||||
}
|
}
|
||||||
public async Task CreateModuleDefinitionAsync(ModuleDefinition moduleDefinition, int moduleId)
|
public async Task CreateModuleDefinitionAsync(ModuleDefinition moduleDefinition, int moduleId)
|
||||||
{
|
{
|
||||||
await _http.PostJsonAsync($"{Apiurl}?moduleid={moduleId.ToString()}", moduleDefinition);
|
await PostJsonAsync($"{Apiurl}?moduleid={moduleId.ToString()}", moduleDefinition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,13 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class ModuleService : ServiceBase, IModuleService
|
public class ModuleService : ServiceBase, IModuleService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
|
||||||
public ModuleService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public ModuleService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<List<Module>> GetModulesAsync(int siteId)
|
public async Task<List<Module>> GetModulesAsync(int siteId)
|
||||||
{
|
{
|
||||||
List<Module> modules = await _http.GetJsonAsync<List<Module>>($"{Apiurl}?siteid={siteId.ToString()}");
|
List<Module> modules = await GetJsonAsync<List<Module>>($"{Apiurl}?siteid={siteId.ToString()}");
|
||||||
modules = modules
|
modules = modules
|
||||||
.OrderBy(item => item.Order)
|
.OrderBy(item => item.Order)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
@ -37,32 +37,32 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<Module> GetModuleAsync(int moduleId)
|
public async Task<Module> GetModuleAsync(int moduleId)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<Module>($"{Apiurl}/{moduleId.ToString()}");
|
return await GetJsonAsync<Module>($"{Apiurl}/{moduleId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Module> AddModuleAsync(Module module)
|
public async Task<Module> AddModuleAsync(Module module)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<Module>(Apiurl, module);
|
return await PostJsonAsync<Module>(Apiurl, module);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Module> UpdateModuleAsync(Module module)
|
public async Task<Module> UpdateModuleAsync(Module module)
|
||||||
{
|
{
|
||||||
return await _http.PutJsonAsync<Module>($"{Apiurl}/{module.ModuleId.ToString()}", module);
|
return await PutJsonAsync<Module>($"{Apiurl}/{module.ModuleId.ToString()}", module);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteModuleAsync(int moduleId)
|
public async Task DeleteModuleAsync(int moduleId)
|
||||||
{
|
{
|
||||||
await _http.DeleteAsync($"{Apiurl}/{moduleId.ToString()}");
|
await DeleteAsync($"{Apiurl}/{moduleId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> ImportModuleAsync(int moduleId, string content)
|
public async Task<bool> ImportModuleAsync(int moduleId, string content)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<bool>($"{Apiurl}/import?moduleid={moduleId}", content);
|
return await PostJsonAsync<string,bool>($"{Apiurl}/import?moduleid={moduleId}", content);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<string> ExportModuleAsync(int moduleId)
|
public async Task<string> ExportModuleAsync(int moduleId)
|
||||||
{
|
{
|
||||||
return await _http.GetStringAsync($"{Apiurl}/export?moduleid={moduleId.ToString()}");
|
return await GetStringAsync($"{Apiurl}/export?moduleid={moduleId.ToString()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,11 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class NotificationService : ServiceBase, INotificationService
|
public class NotificationService : ServiceBase, INotificationService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
|
||||||
public NotificationService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public NotificationService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
}
|
}
|
||||||
|
@ -28,28 +26,29 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<List<Notification>> GetNotificationsAsync(int siteId, string direction, int userId)
|
public async Task<List<Notification>> GetNotificationsAsync(int siteId, string direction, int userId)
|
||||||
{
|
{
|
||||||
var notifications = await _http.GetJsonAsync<List<Notification>>($"{Apiurl}?siteid={siteId.ToString()}&direction={direction.ToLower()}&userid={userId.ToString()}");
|
var notifications = await GetJsonAsync<List<Notification>>($"{Apiurl}?siteid={siteId.ToString()}&direction={direction.ToLower()}&userid={userId.ToString()}");
|
||||||
|
|
||||||
return notifications.OrderByDescending(item => item.CreatedOn).ToList();
|
return notifications.OrderByDescending(item => item.CreatedOn).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Notification> GetNotificationAsync(int notificationId)
|
public async Task<Notification> GetNotificationAsync(int notificationId)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<Notification>($"{Apiurl}/{notificationId.ToString()}");
|
return await GetJsonAsync<Notification>($"{Apiurl}/{notificationId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Notification> AddNotificationAsync(Notification notification)
|
public async Task<Notification> AddNotificationAsync(Notification notification)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<Notification>(Apiurl, notification);
|
return await PostJsonAsync<Notification>(Apiurl, notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Notification> UpdateNotificationAsync(Notification notification)
|
public async Task<Notification> UpdateNotificationAsync(Notification notification)
|
||||||
{
|
{
|
||||||
return await _http.PutJsonAsync<Notification>($"{Apiurl}/{notification.NotificationId.ToString()}", notification);
|
return await PutJsonAsync<Notification>($"{Apiurl}/{notification.NotificationId.ToString()}", notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteNotificationAsync(int notificationId)
|
public async Task DeleteNotificationAsync(int notificationId)
|
||||||
{
|
{
|
||||||
await _http.DeleteAsync($"{Apiurl}/{notificationId.ToString()}");
|
await DeleteAsync($"{Apiurl}/{notificationId.ToString()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,13 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class PackageService : ServiceBase, IPackageService
|
public class PackageService : ServiceBase, IPackageService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
|
||||||
public PackageService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public PackageService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
}
|
}
|
||||||
|
@ -28,13 +28,13 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<List<Package>> GetPackagesAsync(string tag)
|
public async Task<List<Package>> GetPackagesAsync(string tag)
|
||||||
{
|
{
|
||||||
List<Package> packages = await _http.GetJsonAsync<List<Package>>($"{Apiurl}?tag={tag}");
|
List<Package> packages = await GetJsonAsync<List<Package>>($"{Apiurl}?tag={tag}");
|
||||||
return packages.OrderByDescending(item => item.Downloads).ToList();
|
return packages.OrderByDescending(item => item.Downloads).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DownloadPackageAsync(string packageId, string version, string folder)
|
public async Task DownloadPackageAsync(string packageId, string version, string folder)
|
||||||
{
|
{
|
||||||
await _http.PostJsonAsync($"{Apiurl}?packageid={packageId}&version={version}&folder={folder}", null);
|
await PostAsync($"{Apiurl}?packageid={packageId}&version={version}&folder={folder}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,13 +8,13 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class PageModuleService : ServiceBase, IPageModuleService
|
public class PageModuleService : ServiceBase, IPageModuleService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
|
||||||
public PageModuleService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public PageModuleService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
}
|
}
|
||||||
|
@ -26,32 +26,32 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<PageModule> GetPageModuleAsync(int pageModuleId)
|
public async Task<PageModule> GetPageModuleAsync(int pageModuleId)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<PageModule>($"{Apiurl}/{pageModuleId.ToString()}");
|
return await GetJsonAsync<PageModule>($"{Apiurl}/{pageModuleId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<PageModule> GetPageModuleAsync(int pageId, int moduleId)
|
public async Task<PageModule> GetPageModuleAsync(int pageId, int moduleId)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<PageModule>($"{Apiurl}/{pageId.ToString()}/{moduleId.ToString()}");
|
return await GetJsonAsync<PageModule>($"{Apiurl}/{pageId.ToString()}/{moduleId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<PageModule> AddPageModuleAsync(PageModule pageModule)
|
public async Task<PageModule> AddPageModuleAsync(PageModule pageModule)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<PageModule>(Apiurl, pageModule);
|
return await PostJsonAsync<PageModule>(Apiurl, pageModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<PageModule> UpdatePageModuleAsync(PageModule pageModule)
|
public async Task<PageModule> UpdatePageModuleAsync(PageModule pageModule)
|
||||||
{
|
{
|
||||||
return await _http.PutJsonAsync<PageModule>($"{Apiurl}/{pageModule.PageModuleId.ToString()}", pageModule);
|
return await PutJsonAsync<PageModule>($"{Apiurl}/{pageModule.PageModuleId.ToString()}", pageModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdatePageModuleOrderAsync(int pageId, string pane)
|
public async Task UpdatePageModuleOrderAsync(int pageId, string pane)
|
||||||
{
|
{
|
||||||
await _http.PutJsonAsync($"{Apiurl}/?pageid={pageId.ToString()}&pane={pane}", null);
|
await PutAsync($"{Apiurl}/?pageid={pageId.ToString()}&pane={pane}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeletePageModuleAsync(int pageModuleId)
|
public async Task DeletePageModuleAsync(int pageModuleId)
|
||||||
{
|
{
|
||||||
await _http.DeleteAsync($"{Apiurl}/{pageModuleId.ToString()}");
|
await DeleteAsync($"{Apiurl}/{pageModuleId.ToString()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,13 +12,13 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class PageService : ServiceBase, IPageService
|
public class PageService : ServiceBase, IPageService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
|
||||||
public PageService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public PageService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
}
|
}
|
||||||
|
@ -30,26 +30,26 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<List<Page>> GetPagesAsync(int siteId)
|
public async Task<List<Page>> GetPagesAsync(int siteId)
|
||||||
{
|
{
|
||||||
List<Page> pages = await _http.GetJsonAsync<List<Page>>($"{Apiurl}?siteid={siteId.ToString()}");
|
List<Page> pages = await GetJsonAsync<List<Page>>($"{Apiurl}?siteid={siteId.ToString()}");
|
||||||
pages = GetPagesHierarchy(pages);
|
pages = GetPagesHierarchy(pages);
|
||||||
return pages;
|
return pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Page> GetPageAsync(int pageId)
|
public async Task<Page> GetPageAsync(int pageId)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<Page>($"{Apiurl}/{pageId.ToString()}");
|
return await GetJsonAsync<Page>($"{Apiurl}/{pageId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Page> GetPageAsync(int pageId, int userId)
|
public async Task<Page> GetPageAsync(int pageId, int userId)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<Page>($"{Apiurl}/{pageId.ToString()}?userid={userId.ToString()}");
|
return await GetJsonAsync<Page>($"{Apiurl}/{pageId.ToString()}?userid={userId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Page> GetPageAsync(string path, int siteId)
|
public async Task<Page> GetPageAsync(string path, int siteId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<Page>($"{Apiurl}/path/{siteId.ToString()}?path={WebUtility.UrlEncode(path)}");
|
return await GetJsonAsync<Page>($"{Apiurl}/path/{siteId.ToString()}?path={WebUtility.UrlEncode(path)}");
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -59,17 +59,17 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<Page> AddPageAsync(Page page)
|
public async Task<Page> AddPageAsync(Page page)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<Page>(Apiurl, page);
|
return await PostJsonAsync<Page>(Apiurl, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Page> AddPageAsync(int pageId, int userId)
|
public async Task<Page> AddPageAsync(int pageId, int userId)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<Page>($"{Apiurl}/{pageId.ToString()}?userid={userId.ToString()}", null);
|
return await PostJsonAsync<Page>($"{Apiurl}/{pageId.ToString()}?userid={userId.ToString()}", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Page> UpdatePageAsync(Page page)
|
public async Task<Page> UpdatePageAsync(Page page)
|
||||||
{
|
{
|
||||||
return await _http.PutJsonAsync<Page>($"{Apiurl}/{page.PageId.ToString()}", page);
|
return await PutJsonAsync<Page>($"{Apiurl}/{page.PageId.ToString()}", page);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdatePageOrderAsync(int siteId, int pageId, int? parentId)
|
public async Task UpdatePageOrderAsync(int siteId, int pageId, int? parentId)
|
||||||
|
@ -77,12 +77,12 @@ namespace Oqtane.Services
|
||||||
var parent = parentId == null
|
var parent = parentId == null
|
||||||
? string.Empty
|
? string.Empty
|
||||||
: parentId.ToString();
|
: parentId.ToString();
|
||||||
await _http.PutJsonAsync($"{Apiurl}/?siteid={siteId.ToString()}&pageid={pageId.ToString()}&parentid={parent}", null);
|
await PutAsync($"{Apiurl}/?siteid={siteId.ToString()}&pageid={pageId.ToString()}&parentid={parent}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeletePageAsync(int pageId)
|
public async Task DeletePageAsync(int pageId)
|
||||||
{
|
{
|
||||||
await _http.DeleteAsync($"{Apiurl}/{pageId.ToString()}");
|
await DeleteAsync($"{Apiurl}/{pageId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Page> GetPagesHierarchy(List<Page> pages)
|
private static List<Page> GetPagesHierarchy(List<Page> pages)
|
||||||
|
|
|
@ -10,13 +10,13 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class ProfileService : ServiceBase, IProfileService
|
public class ProfileService : ServiceBase, IProfileService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
|
||||||
public ProfileService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public ProfileService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
}
|
}
|
||||||
|
@ -28,27 +28,27 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<List<Profile>> GetProfilesAsync(int siteId)
|
public async Task<List<Profile>> GetProfilesAsync(int siteId)
|
||||||
{
|
{
|
||||||
List<Profile> profiles = await _http.GetJsonAsync<List<Profile>>($"{Apiurl}?siteid={siteId.ToString()}");
|
List<Profile> profiles = await GetJsonAsync<List<Profile>>($"{Apiurl}?siteid={siteId.ToString()}");
|
||||||
return profiles.OrderBy(item => item.ViewOrder).ToList();
|
return profiles.OrderBy(item => item.ViewOrder).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Profile> GetProfileAsync(int profileId)
|
public async Task<Profile> GetProfileAsync(int profileId)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<Profile>($"{Apiurl}/{profileId.ToString()}");
|
return await GetJsonAsync<Profile>($"{Apiurl}/{profileId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Profile> AddProfileAsync(Profile profile)
|
public async Task<Profile> AddProfileAsync(Profile profile)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<Profile>(Apiurl, profile);
|
return await PostJsonAsync<Profile>(Apiurl, profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Profile> UpdateProfileAsync(Profile profile)
|
public async Task<Profile> UpdateProfileAsync(Profile profile)
|
||||||
{
|
{
|
||||||
return await _http.PutJsonAsync<Profile>($"{Apiurl}/{profile.SiteId.ToString()}", profile);
|
return await PutJsonAsync<Profile>($"{Apiurl}/{profile.SiteId.ToString()}", profile);
|
||||||
}
|
}
|
||||||
public async Task DeleteProfileAsync(int profileId)
|
public async Task DeleteProfileAsync(int profileId)
|
||||||
{
|
{
|
||||||
await _http.DeleteAsync($"{Apiurl}/{profileId.ToString()}");
|
await DeleteAsync($"{Apiurl}/{profileId.ToString()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,13 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class RoleService : ServiceBase, IRoleService
|
public class RoleService : ServiceBase, IRoleService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
|
||||||
public RoleService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public RoleService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
}
|
}
|
||||||
|
@ -28,27 +28,27 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<List<Role>> GetRolesAsync(int siteId)
|
public async Task<List<Role>> GetRolesAsync(int siteId)
|
||||||
{
|
{
|
||||||
List<Role> roles = await _http.GetJsonAsync<List<Role>>($"{Apiurl}?siteid={siteId.ToString()}");
|
List<Role> roles = await GetJsonAsync<List<Role>>($"{Apiurl}?siteid={siteId.ToString()}");
|
||||||
return roles.OrderBy(item => item.Name).ToList();
|
return roles.OrderBy(item => item.Name).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Role> GetRoleAsync(int roleId)
|
public async Task<Role> GetRoleAsync(int roleId)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<Role>($"{Apiurl}/{roleId.ToString()}");
|
return await GetJsonAsync<Role>($"{Apiurl}/{roleId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Role> AddRoleAsync(Role role)
|
public async Task<Role> AddRoleAsync(Role role)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<Role>(Apiurl, role);
|
return await PostJsonAsync<Role>(Apiurl, role);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Role> UpdateRoleAsync(Role role)
|
public async Task<Role> UpdateRoleAsync(Role role)
|
||||||
{
|
{
|
||||||
return await _http.PutJsonAsync<Role>($"{Apiurl}/{role.RoleId.ToString()}", role);
|
return await PutJsonAsync<Role>($"{Apiurl}/{role.RoleId.ToString()}", role);
|
||||||
}
|
}
|
||||||
public async Task DeleteRoleAsync(int roleId)
|
public async Task DeleteRoleAsync(int roleId)
|
||||||
{
|
{
|
||||||
await _http.DeleteAsync($"{Apiurl}/{roleId.ToString()}");
|
await DeleteAsync($"{Apiurl}/{roleId.ToString()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,101 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Net.Http.Json;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
|
using Oqtane.Modules.HtmlText.Models;
|
||||||
|
|
||||||
namespace Oqtane.Services
|
namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class ServiceBase
|
public class ServiceBase
|
||||||
{
|
{
|
||||||
|
private readonly HttpClient _http;
|
||||||
|
|
||||||
|
protected ServiceBase(HttpClient client)
|
||||||
|
{
|
||||||
|
_http = client;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task<T> PutJsonAsync<T>(string uri, T value)
|
||||||
|
{
|
||||||
|
var response = await _http.PutAsJsonAsync(uri, value);
|
||||||
|
var result = await response.Content.ReadFromJsonAsync<T>();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task PutAsync(string uri)
|
||||||
|
{
|
||||||
|
await _http.PutAsync(uri, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task PostAsync(string uri)
|
||||||
|
{
|
||||||
|
await _http.PostAsync(uri, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task GetAsync(string uri)
|
||||||
|
{
|
||||||
|
await _http.GetAsync(uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task<byte[]> GetByteArrayAsync(string uri)
|
||||||
|
{
|
||||||
|
return await _http.GetByteArrayAsync(uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task<R> PostJsonAsync<T, R>(string uri, T value)
|
||||||
|
{
|
||||||
|
var response = await _http.PostAsJsonAsync(uri, value);
|
||||||
|
if (!ValidateJsonContent(response.Content)) return default;
|
||||||
|
|
||||||
|
var result = await response.Content.ReadFromJsonAsync<R>();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool ValidateJsonContent(HttpContent content)
|
||||||
|
{
|
||||||
|
var mediaType = content?.Headers.ContentType?.MediaType;
|
||||||
|
return mediaType != null && mediaType.Equals("application/json", StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task<T> PostJsonAsync<T>(string uri, T value)
|
||||||
|
{
|
||||||
|
return await PostJsonAsync<T, T>(uri, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task<T> GetJsonAsync<T>(string uri)
|
||||||
|
{
|
||||||
|
var response = await _http.GetAsync(uri, HttpCompletionOption.ResponseHeadersRead, CancellationToken.None);
|
||||||
|
if (CheckResponse(response) && ValidateJsonContent(response.Content))
|
||||||
|
{
|
||||||
|
return await response.Content.ReadFromJsonAsync<T>();
|
||||||
|
}
|
||||||
|
|
||||||
|
return default;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CheckResponse(HttpResponseMessage response)
|
||||||
|
{
|
||||||
|
if (response.IsSuccessStatusCode) return true;
|
||||||
|
if (response.StatusCode != HttpStatusCode.NoContent && response.StatusCode != HttpStatusCode.NotFound)
|
||||||
|
{
|
||||||
|
//TODO: Log error here
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task DeleteAsync(string uri)
|
||||||
|
{
|
||||||
|
await _http.DeleteAsync(uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async Task<string> GetStringAsync(string uri)
|
||||||
|
{
|
||||||
|
return await _http.GetStringAsync(uri);
|
||||||
|
}
|
||||||
|
|
||||||
public static string CreateApiUrl(Alias alias, string absoluteUri, string serviceName)
|
public static string CreateApiUrl(Alias alias, string absoluteUri, string serviceName)
|
||||||
{
|
{
|
||||||
|
@ -25,6 +116,7 @@ namespace Oqtane.Services
|
||||||
// build a url which ignores any subfolder for multi-tenancy
|
// build a url which ignores any subfolder for multi-tenancy
|
||||||
apiurl = $"{uri.Scheme}://{uri.Authority}/~/";
|
apiurl = $"{uri.Scheme}://{uri.Authority}/~/";
|
||||||
}
|
}
|
||||||
|
|
||||||
apiurl += $"api/{serviceName}";
|
apiurl += $"api/{serviceName}";
|
||||||
|
|
||||||
return apiurl;
|
return apiurl;
|
||||||
|
@ -37,6 +129,7 @@ namespace Oqtane.Services
|
||||||
url += (url.Contains("?")) ? "&" : "?";
|
url += (url.Contains("?")) ? "&" : "?";
|
||||||
url += "aliasid=" + alias.AliasId.ToString();
|
url += "aliasid=" + alias.AliasId.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,13 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class SettingService : ServiceBase, ISettingService
|
public class SettingService : ServiceBase, ISettingService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
|
||||||
public SettingService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public SettingService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ namespace Oqtane.Services
|
||||||
public async Task<Dictionary<string, string>> GetSettingsAsync(string entityName, int entityId)
|
public async Task<Dictionary<string, string>> GetSettingsAsync(string entityName, int entityId)
|
||||||
{
|
{
|
||||||
var dictionary = new Dictionary<string, string>();
|
var dictionary = new Dictionary<string, string>();
|
||||||
var settings = await _http.GetJsonAsync<List<Setting>>($"{Apiurl}?entityname={entityName}&entityid={entityId.ToString()}");
|
var settings = await GetJsonAsync<List<Setting>>($"{Apiurl}?entityname={entityName}&entityid={entityId.ToString()}");
|
||||||
|
|
||||||
foreach(Setting setting in settings.OrderBy(item => item.SettingName).ToList())
|
foreach(Setting setting in settings.OrderBy(item => item.SettingName).ToList())
|
||||||
{
|
{
|
||||||
|
@ -110,7 +110,7 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task UpdateSettingsAsync(Dictionary<string, string> settings, string entityName, int entityId)
|
public async Task UpdateSettingsAsync(Dictionary<string, string> settings, string entityName, int entityId)
|
||||||
{
|
{
|
||||||
var settingsList = await _http.GetJsonAsync<List<Setting>>($"{Apiurl}?entityname={entityName}&entityid={entityId.ToString()}");
|
var settingsList = await GetJsonAsync<List<Setting>>($"{Apiurl}?entityname={entityName}&entityid={entityId.ToString()}");
|
||||||
|
|
||||||
foreach (KeyValuePair<string, string> kvp in settings)
|
foreach (KeyValuePair<string, string> kvp in settings)
|
||||||
{
|
{
|
||||||
|
@ -138,22 +138,22 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<Setting> GetSettingAsync(int settingId)
|
public async Task<Setting> GetSettingAsync(int settingId)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<Setting>($"{Apiurl}/{settingId.ToString()}");
|
return await GetJsonAsync<Setting>($"{Apiurl}/{settingId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Setting> AddSettingAsync(Setting setting)
|
public async Task<Setting> AddSettingAsync(Setting setting)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<Setting>(Apiurl, setting);
|
return await PostJsonAsync<Setting>(Apiurl, setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Setting> UpdateSettingAsync(Setting setting)
|
public async Task<Setting> UpdateSettingAsync(Setting setting)
|
||||||
{
|
{
|
||||||
return await _http.PutJsonAsync<Setting>($"{Apiurl}/{setting.SettingId.ToString()}", setting);
|
return await PutJsonAsync<Setting>($"{Apiurl}/{setting.SettingId.ToString()}", setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteSettingAsync(int settingId)
|
public async Task DeleteSettingAsync(int settingId)
|
||||||
{
|
{
|
||||||
await _http.DeleteAsync($"{Apiurl}/{settingId.ToString()}");
|
await DeleteAsync($"{Apiurl}/{settingId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,13 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class SiteService : ServiceBase, ISiteService
|
public class SiteService : ServiceBase, ISiteService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
|
||||||
public SiteService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public SiteService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
}
|
}
|
||||||
|
@ -28,28 +28,28 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<List<Site>> GetSitesAsync(Alias alias)
|
public async Task<List<Site>> GetSitesAsync(Alias alias)
|
||||||
{
|
{
|
||||||
List<Site> sites = await _http.GetJsonAsync<List<Site>>(CreateCrossTenantUrl(Apiurl, alias));
|
List<Site> sites = await GetJsonAsync<List<Site>>(CreateCrossTenantUrl(Apiurl, alias));
|
||||||
return sites.OrderBy(item => item.Name).ToList();
|
return sites.OrderBy(item => item.Name).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Site> GetSiteAsync(int siteId, Alias alias)
|
public async Task<Site> GetSiteAsync(int siteId, Alias alias)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<Site>(CreateCrossTenantUrl($"{Apiurl}/{siteId.ToString()}", alias));
|
return await GetJsonAsync<Site>(CreateCrossTenantUrl($"{Apiurl}/{siteId.ToString()}", alias));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Site> AddSiteAsync(Site site, Alias alias)
|
public async Task<Site> AddSiteAsync(Site site, Alias alias)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<Site>(CreateCrossTenantUrl(Apiurl, alias), site);
|
return await PostJsonAsync<Site>(CreateCrossTenantUrl(Apiurl, alias), site);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Site> UpdateSiteAsync(Site site, Alias alias)
|
public async Task<Site> UpdateSiteAsync(Site site, Alias alias)
|
||||||
{
|
{
|
||||||
return await _http.PutJsonAsync<Site>(CreateCrossTenantUrl($"{Apiurl}/{site.SiteId.ToString()}", alias), site);
|
return await PutJsonAsync<Site>(CreateCrossTenantUrl($"{Apiurl}/{site.SiteId.ToString()}", alias), site);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteSiteAsync(int siteId, Alias alias)
|
public async Task DeleteSiteAsync(int siteId, Alias alias)
|
||||||
{
|
{
|
||||||
await _http.DeleteAsync(CreateCrossTenantUrl($"{Apiurl}/{siteId.ToString()}", alias));
|
await DeleteAsync(CreateCrossTenantUrl($"{Apiurl}/{siteId.ToString()}", alias));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,13 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class SiteTemplateService : ServiceBase, ISiteTemplateService
|
public class SiteTemplateService : ServiceBase, ISiteTemplateService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
|
||||||
public SiteTemplateService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public SiteTemplateService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<List<SiteTemplate>> GetSiteTemplatesAsync()
|
public async Task<List<SiteTemplate>> GetSiteTemplatesAsync()
|
||||||
{
|
{
|
||||||
List<SiteTemplate> siteTemplates = await _http.GetJsonAsync<List<SiteTemplate>>(Apiurl);
|
List<SiteTemplate> siteTemplates = await GetJsonAsync<List<SiteTemplate>>(Apiurl);
|
||||||
return siteTemplates.OrderBy(item => item.Name).ToList();
|
return siteTemplates.OrderBy(item => item.Name).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,13 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class SqlService : ServiceBase, ISqlService
|
public class SqlService : ServiceBase, ISqlService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
|
||||||
public SqlService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public SqlService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<SqlQuery> ExecuteQueryAsync(SqlQuery sqlquery)
|
public async Task<SqlQuery> ExecuteQueryAsync(SqlQuery sqlquery)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<SqlQuery>(Apiurl, sqlquery);
|
return await PostJsonAsync<SqlQuery>(Apiurl, sqlquery);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,13 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class TenantService : ServiceBase, ITenantService
|
public class TenantService : ServiceBase, ITenantService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
|
||||||
public TenantService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public TenantService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
}
|
}
|
||||||
|
@ -28,28 +28,28 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<List<Tenant>> GetTenantsAsync()
|
public async Task<List<Tenant>> GetTenantsAsync()
|
||||||
{
|
{
|
||||||
List<Tenant> tenants = await _http.GetJsonAsync<List<Tenant>>(Apiurl);
|
List<Tenant> tenants = await GetJsonAsync<List<Tenant>>(Apiurl);
|
||||||
return tenants.OrderBy(item => item.Name).ToList();
|
return tenants.OrderBy(item => item.Name).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Tenant> GetTenantAsync(int tenantId)
|
public async Task<Tenant> GetTenantAsync(int tenantId)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<Tenant>($"{Apiurl}/{tenantId.ToString()}");
|
return await GetJsonAsync<Tenant>($"{Apiurl}/{tenantId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Tenant> AddTenantAsync(Tenant tenant)
|
public async Task<Tenant> AddTenantAsync(Tenant tenant)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<Tenant>(Apiurl, tenant);
|
return await PostJsonAsync<Tenant>(Apiurl, tenant);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Tenant> UpdateTenantAsync(Tenant tenant)
|
public async Task<Tenant> UpdateTenantAsync(Tenant tenant)
|
||||||
{
|
{
|
||||||
return await _http.PutJsonAsync<Tenant>($"{Apiurl}/{tenant.TenantId.ToString()}", tenant);
|
return await PutJsonAsync<Tenant>($"{Apiurl}/{tenant.TenantId.ToString()}", tenant);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteTenantAsync(int tenantId)
|
public async Task DeleteTenantAsync(int tenantId)
|
||||||
{
|
{
|
||||||
await _http.DeleteAsync($"{Apiurl}/{tenantId.ToString()}");
|
await DeleteAsync($"{Apiurl}/{tenantId.ToString()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace Oqtane.Services
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
|
||||||
public ThemeService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public ThemeService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
_http = http;
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
|
@ -30,7 +30,7 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<List<Theme>> GetThemesAsync()
|
public async Task<List<Theme>> GetThemesAsync()
|
||||||
{
|
{
|
||||||
List<Theme> themes = await _http.GetJsonAsync<List<Theme>>(Apiurl);
|
List<Theme> themes = await GetJsonAsync<List<Theme>>(Apiurl);
|
||||||
|
|
||||||
// get list of loaded assemblies
|
// get list of loaded assemblies
|
||||||
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||||
|
@ -105,12 +105,12 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task InstallThemesAsync()
|
public async Task InstallThemesAsync()
|
||||||
{
|
{
|
||||||
await _http.GetJsonAsync<List<string>>($"{Apiurl}/install");
|
await GetJsonAsync<List<string>>($"{Apiurl}/install");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteThemeAsync(string themeName)
|
public async Task DeleteThemeAsync(string themeName)
|
||||||
{
|
{
|
||||||
await _http.DeleteAsync($"{Apiurl}/{themeName}");
|
await DeleteAsync($"{Apiurl}/{themeName}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,13 +9,13 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class UserRoleService : ServiceBase, IUserRoleService
|
public class UserRoleService : ServiceBase, IUserRoleService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
|
|
||||||
public UserRoleService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
public UserRoleService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
}
|
}
|
||||||
|
@ -27,27 +27,27 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<List<UserRole>> GetUserRolesAsync(int siteId)
|
public async Task<List<UserRole>> GetUserRolesAsync(int siteId)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<List<UserRole>>($"{Apiurl}?siteid={siteId.ToString()}");
|
return await GetJsonAsync<List<UserRole>>($"{Apiurl}?siteid={siteId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<UserRole> GetUserRoleAsync(int userRoleId)
|
public async Task<UserRole> GetUserRoleAsync(int userRoleId)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<UserRole>($"{Apiurl}/{userRoleId.ToString()}");
|
return await GetJsonAsync<UserRole>($"{Apiurl}/{userRoleId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<UserRole> AddUserRoleAsync(UserRole userRole)
|
public async Task<UserRole> AddUserRoleAsync(UserRole userRole)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<UserRole>(Apiurl, userRole);
|
return await PostJsonAsync<UserRole>(Apiurl, userRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<UserRole> UpdateUserRoleAsync(UserRole userRole)
|
public async Task<UserRole> UpdateUserRoleAsync(UserRole userRole)
|
||||||
{
|
{
|
||||||
return await _http.PutJsonAsync<UserRole>($"{Apiurl}/{userRole.UserRoleId.ToString()}", userRole);
|
return await PutJsonAsync<UserRole>($"{Apiurl}/{userRole.UserRoleId.ToString()}", userRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteUserRoleAsync(int userRoleId)
|
public async Task DeleteUserRoleAsync(int userRoleId)
|
||||||
{
|
{
|
||||||
await _http.DeleteAsync($"{Apiurl}/{userRoleId.ToString()}");
|
await DeleteAsync($"{Apiurl}/{userRoleId.ToString()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,14 +8,14 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class UserService : ServiceBase, IUserService
|
public class UserService : ServiceBase, IUserService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
|
||||||
private readonly SiteState _siteState;
|
private readonly SiteState _siteState;
|
||||||
private readonly NavigationManager _navigationManager;
|
private readonly NavigationManager _navigationManager;
|
||||||
private readonly ISiteService _siteService;
|
private readonly ISiteService _siteService;
|
||||||
|
|
||||||
public UserService(HttpClient http, SiteState siteState, NavigationManager navigationManager, ISiteService siteService)
|
public UserService(HttpClient http, SiteState siteState, NavigationManager navigationManager, ISiteService siteService) : base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
|
||||||
_siteState = siteState;
|
_siteState = siteState;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
_siteService = siteService;
|
_siteService = siteService;
|
||||||
|
@ -28,12 +28,12 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<User> GetUserAsync(int userId, int siteId)
|
public async Task<User> GetUserAsync(int userId, int siteId)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<User>($"{Apiurl}/{userId.ToString()}?siteid={siteId.ToString()}");
|
return await GetJsonAsync<User>($"{Apiurl}/{userId.ToString()}?siteid={siteId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<User> GetUserAsync(string username, int siteId)
|
public async Task<User> GetUserAsync(string username, int siteId)
|
||||||
{
|
{
|
||||||
return await _http.GetJsonAsync<User>($"{Apiurl}/name/{username}?siteid={siteId.ToString()}");
|
return await GetJsonAsync<User>($"{Apiurl}/name/{username}?siteid={siteId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<User> AddUserAsync(User user)
|
public async Task<User> AddUserAsync(User user)
|
||||||
|
@ -47,7 +47,7 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<User>(Apiurl, user);
|
return await PostJsonAsync<User>(Apiurl, user);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -59,7 +59,7 @@ namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<User>(CreateCrossTenantUrl(Apiurl, alias), user);
|
return await PostJsonAsync<User>(CreateCrossTenantUrl(Apiurl, alias), user);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -69,37 +69,37 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<User> UpdateUserAsync(User user)
|
public async Task<User> UpdateUserAsync(User user)
|
||||||
{
|
{
|
||||||
return await _http.PutJsonAsync<User>($"{Apiurl}/{user.UserId.ToString()}", user);
|
return await PutJsonAsync<User>($"{Apiurl}/{user.UserId.ToString()}", user);
|
||||||
}
|
}
|
||||||
public async Task DeleteUserAsync(int userId)
|
public async Task DeleteUserAsync(int userId)
|
||||||
{
|
{
|
||||||
await _http.DeleteAsync($"{Apiurl}/{userId.ToString()}");
|
await DeleteAsync($"{Apiurl}/{userId.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<User> LoginUserAsync(User user, bool setCookie, bool isPersistent)
|
public async Task<User> LoginUserAsync(User user, bool setCookie, bool isPersistent)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<User>($"{Apiurl}/login?setcookie={setCookie.ToString()}&persistent={isPersistent.ToString()}", user);
|
return await PostJsonAsync<User>($"{Apiurl}/login?setcookie={setCookie.ToString()}&persistent={isPersistent.ToString()}", user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task LogoutUserAsync(User user)
|
public async Task LogoutUserAsync(User user)
|
||||||
{
|
{
|
||||||
// best practices recommend post is preferrable to get for logout
|
// best practices recommend post is preferrable to get for logout
|
||||||
await _http.PostJsonAsync($"{Apiurl}/logout", user);
|
await PostJsonAsync($"{Apiurl}/logout", user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<User> VerifyEmailAsync(User user, string token)
|
public async Task<User> VerifyEmailAsync(User user, string token)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<User>($"{Apiurl}/verify?token={token}", user);
|
return await PostJsonAsync<User>($"{Apiurl}/verify?token={token}", user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ForgotPasswordAsync(User user)
|
public async Task ForgotPasswordAsync(User user)
|
||||||
{
|
{
|
||||||
await _http.PostJsonAsync($"{Apiurl}/forgot", user);
|
await PostJsonAsync($"{Apiurl}/forgot", user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<User> ResetPasswordAsync(User user, string token)
|
public async Task<User> ResetPasswordAsync(User user, string token)
|
||||||
{
|
{
|
||||||
return await _http.PostJsonAsync<User>($"{Apiurl}/reset?token={token}", user);
|
return await PostJsonAsync<User>($"{Apiurl}/reset?token={token}", user);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,9 +63,11 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
// get sync events
|
// get sync events
|
||||||
|
if (alias != null)
|
||||||
|
{
|
||||||
alias.SyncDate = DateTime.UtcNow;
|
alias.SyncDate = DateTime.UtcNow;
|
||||||
alias.SyncEvents = _syncManager.GetSyncEvents(DateTime.ParseExact(lastsyncdate, "yyyyMMddHHmmssfff", CultureInfo.InvariantCulture));
|
alias.SyncEvents = _syncManager.GetSyncEvents(DateTime.ParseExact(lastsyncdate, "yyyyMMddHHmmssfff", CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
return alias;
|
return alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,12 +42,7 @@ namespace Oqtane
|
||||||
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
|
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddMvc(opt =>
|
services.AddMvc().AddNewtonsoftJson();
|
||||||
{
|
|
||||||
// remove formatter that turns nulls into 204 - No Content responses
|
|
||||||
// sends JSON null instead
|
|
||||||
opt.OutputFormatters.RemoveType<HttpNoContentOutputFormatter>();
|
|
||||||
}).AddNewtonsoftJson();
|
|
||||||
services.AddServerSideBlazor();
|
services.AddServerSideBlazor();
|
||||||
|
|
||||||
// setup HttpClient for server side in a client side compatible fashion ( with auth cookie )
|
// setup HttpClient for server side in a client side compatible fashion ( with auth cookie )
|
||||||
|
|
Loading…
Reference in New Issue
Block a user