Client fixes
Client is partially done. 227 warnings left out of 1500 I like Rider
This commit is contained in:
@ -23,25 +23,25 @@ namespace Oqtane.Services
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Alias"); }
|
||||
}
|
||||
|
||||
public async Task<List<Alias>> GetAliasesAsync()
|
||||
{
|
||||
List<Alias> aliases = await _http.GetJsonAsync<List<Alias>>(apiurl);
|
||||
List<Alias> aliases = await _http.GetJsonAsync<List<Alias>>(Apiurl);
|
||||
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 _http.GetJsonAsync<Alias>(Apiurl + "/" + aliasId.ToString());
|
||||
}
|
||||
|
||||
public async Task<Alias> GetAliasAsync(string Url, DateTime LastSyncDate)
|
||||
public async Task<Alias> GetAliasAsync(string url, DateTime lastSyncDate)
|
||||
{
|
||||
Uri uri = new Uri(Url);
|
||||
Uri uri = new Uri(url);
|
||||
string name = uri.Authority;
|
||||
if (uri.Segments.Count() > 1)
|
||||
{
|
||||
@ -51,21 +51,21 @@ namespace Oqtane.Services
|
||||
{
|
||||
name = name.Substring(0, name.Length - 1);
|
||||
}
|
||||
return await _http.GetJsonAsync<Alias>(apiurl + "/name/" + WebUtility.UrlEncode(name) + "?lastsyncdate=" + LastSyncDate.ToString("yyyyMMddHHmmssfff"));
|
||||
return await _http.GetJsonAsync<Alias>(Apiurl + "/name/" + WebUtility.UrlEncode(name) + "?lastsyncdate=" + lastSyncDate.ToString("yyyyMMddHHmmssfff"));
|
||||
}
|
||||
|
||||
public async Task<Alias> AddAliasAsync(Alias alias)
|
||||
{
|
||||
return await _http.PostJsonAsync<Alias>(apiurl, alias);
|
||||
return await _http.PostJsonAsync<Alias>(Apiurl, alias);
|
||||
}
|
||||
|
||||
public async Task<Alias> UpdateAliasAsync(Alias alias)
|
||||
{
|
||||
return await _http.PutJsonAsync<Alias>(apiurl + "/" + alias.AliasId.ToString(), alias);
|
||||
return await _http.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 _http.DeleteAsync(Apiurl + "/" + aliasId.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
@ -28,65 +27,65 @@ namespace Oqtane.Services
|
||||
_jsRuntime = jsRuntime;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "File"); }
|
||||
}
|
||||
|
||||
public async Task<List<File>> GetFilesAsync(int FolderId)
|
||||
public async Task<List<File>> GetFilesAsync(int folderId)
|
||||
{
|
||||
return await GetFilesAsync(FolderId.ToString());
|
||||
return await GetFilesAsync(folderId.ToString());
|
||||
}
|
||||
|
||||
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 _http.GetJsonAsync<List<File>>(Apiurl + "?folder=" + folder);
|
||||
}
|
||||
|
||||
public async Task<List<File>> GetFilesAsync(int siteId, string folderPath)
|
||||
{
|
||||
if (!folderPath.EndsWith("\\")) folderPath += "\\";
|
||||
var path = WebUtility.UrlEncode(folderPath);
|
||||
return await _http.GetJsonAsync<List<File>>($"{apiurl}/{siteId}/{path}");
|
||||
return await _http.GetJsonAsync<List<File>>($"{Apiurl}/{siteId}/{path}");
|
||||
}
|
||||
|
||||
public async Task<File> GetFileAsync(int FileId)
|
||||
public async Task<File> GetFileAsync(int fileId)
|
||||
{
|
||||
return await _http.GetJsonAsync<File>(apiurl + "/" + FileId.ToString());
|
||||
return await _http.GetJsonAsync<File>(Apiurl + "/" + fileId.ToString());
|
||||
}
|
||||
|
||||
public async Task<File> AddFileAsync(File File)
|
||||
public async Task<File> AddFileAsync(File file)
|
||||
{
|
||||
return await _http.PostJsonAsync<File>(apiurl, File);
|
||||
return await _http.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 _http.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 _http.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 _http.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)
|
||||
{
|
||||
return await UploadFilesAsync(FolderId.ToString(), Files, Id);
|
||||
return await UploadFilesAsync(folderId.ToString(), files, id);
|
||||
}
|
||||
|
||||
public async Task<string> UploadFilesAsync(string Folder, string[] Files, string Id)
|
||||
public async Task<string> UploadFilesAsync(string folder, string[] files, string id)
|
||||
{
|
||||
string result = "";
|
||||
|
||||
var interop = new Interop(_jsRuntime);
|
||||
await interop.UploadFiles(apiurl + "/upload", Folder, Id);
|
||||
await interop.UploadFiles(Apiurl + "/upload", folder, id);
|
||||
|
||||
// uploading files is asynchronous so we need to wait for the upload to complete
|
||||
bool success = false;
|
||||
@ -96,13 +95,13 @@ namespace Oqtane.Services
|
||||
Thread.Sleep(2000); // wait 2 seconds
|
||||
result = "";
|
||||
|
||||
List<File> files = await GetFilesAsync(Folder);
|
||||
if (files.Count > 0)
|
||||
List<File> fileList = await GetFilesAsync(folder);
|
||||
if (fileList.Count > 0)
|
||||
{
|
||||
success = true;
|
||||
foreach (string file in Files)
|
||||
foreach (string file in files)
|
||||
{
|
||||
if (!files.Exists(item => item.Name == file))
|
||||
if (!fileList.Exists(item => item.Name == file))
|
||||
{
|
||||
success = false;
|
||||
result += file + ",";
|
||||
@ -121,9 +120,9 @@ namespace Oqtane.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<byte[]> DownloadFileAsync(int FileId)
|
||||
public async Task<byte[]> DownloadFileAsync(int fileId)
|
||||
{
|
||||
return await _http.GetByteArrayAsync(apiurl + "/download/" + FileId.ToString());
|
||||
return await _http.GetByteArrayAsync(Apiurl + "/download/" + fileId.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,16 +26,16 @@ namespace Oqtane.Services
|
||||
|
||||
private string ApiUrl => CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Folder");
|
||||
|
||||
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 _http.GetJsonAsync<List<Folder>>(ApiUrl + "?siteid=" + siteId.ToString());
|
||||
folders = GetFoldersHierarchy(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 _http.GetJsonAsync<Folder>(ApiUrl + "/" + folderId.ToString());
|
||||
}
|
||||
|
||||
public async Task<Folder> GetFolderAsync(int siteId, [NotNull] string folderPath)
|
||||
@ -45,60 +45,61 @@ namespace Oqtane.Services
|
||||
return await _http.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 _http.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 _http.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)
|
||||
{
|
||||
await _http.PutJsonAsync(
|
||||
ApiUrl + "/?siteid=" + SiteId.ToString() + "&folderid=" + FolderId.ToString() + "&parentid=" +
|
||||
((ParentId == null) ? "" : ParentId.ToString()), null);
|
||||
ApiUrl + "/?siteid=" + siteId.ToString() + "&folderid=" + folderId.ToString() + "&parentid=" +
|
||||
((parentId == null) ? "" : parentId.ToString()), null);
|
||||
}
|
||||
|
||||
public async Task DeleteFolderAsync(int FolderId)
|
||||
public async Task DeleteFolderAsync(int folderId)
|
||||
{
|
||||
await _http.DeleteAsync(ApiUrl + "/" + FolderId.ToString());
|
||||
await _http.DeleteAsync(ApiUrl + "/" + folderId.ToString());
|
||||
}
|
||||
|
||||
private static List<Folder> GetFoldersHierarchy(List<Folder> Folders)
|
||||
private static List<Folder> GetFoldersHierarchy(List<Folder> folders)
|
||||
{
|
||||
List<Folder> hierarchy = new List<Folder>();
|
||||
Action<List<Folder>, Folder> GetPath = null;
|
||||
GetPath = (List<Folder> folders, Folder folder) =>
|
||||
Action<List<Folder>, Folder> getPath = null;
|
||||
var folders1 = folders;
|
||||
getPath = (folderList, folder) =>
|
||||
{
|
||||
IEnumerable<Folder> children;
|
||||
int level;
|
||||
if (folder == null)
|
||||
{
|
||||
level = -1;
|
||||
children = Folders.Where(item => item.ParentId == null);
|
||||
children = folders1.Where(item => item.ParentId == null);
|
||||
}
|
||||
else
|
||||
{
|
||||
level = folder.Level;
|
||||
children = Folders.Where(item => item.ParentId == folder.FolderId);
|
||||
children = folders1.Where(item => item.ParentId == folder.FolderId);
|
||||
}
|
||||
|
||||
foreach (Folder child in children)
|
||||
{
|
||||
child.Level = level + 1;
|
||||
child.HasChildren = Folders.Any(item => item.ParentId == child.FolderId);
|
||||
child.HasChildren = folders1.Any(item => item.ParentId == child.FolderId);
|
||||
hierarchy.Add(child);
|
||||
GetPath(folders, child);
|
||||
if (getPath != null) getPath(folderList, child);
|
||||
}
|
||||
};
|
||||
Folders = Folders.OrderBy(item => item.Order).ToList();
|
||||
GetPath(Folders, null);
|
||||
folders = folders.OrderBy(item => item.Order).ToList();
|
||||
getPath(folders, null);
|
||||
|
||||
// add any non-hierarchical items to the end of the list
|
||||
foreach (Folder folder in Folders)
|
||||
foreach (Folder folder in folders)
|
||||
{
|
||||
if (hierarchy.Find(item => item.FolderId == folder.FolderId) == null)
|
||||
{
|
||||
|
@ -1,9 +1,7 @@
|
||||
using Oqtane.Models;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
@ -21,24 +19,24 @@ namespace Oqtane.Services
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Installation"); }
|
||||
}
|
||||
|
||||
public async Task<GenericResponse> IsInstalled()
|
||||
{
|
||||
return await _http.GetJsonAsync<GenericResponse>(apiurl + "/installed");
|
||||
return await _http.GetJsonAsync<GenericResponse>(Apiurl + "/installed");
|
||||
}
|
||||
|
||||
public async Task<GenericResponse> Install(string connectionstring)
|
||||
{
|
||||
return await _http.PostJsonAsync<GenericResponse>(apiurl, connectionstring);
|
||||
return await _http.PostJsonAsync<GenericResponse>(Apiurl, connectionstring);
|
||||
}
|
||||
|
||||
public async Task<GenericResponse> Upgrade()
|
||||
{
|
||||
return await _http.GetJsonAsync<GenericResponse>(apiurl + "/upgrade");
|
||||
return await _http.GetJsonAsync<GenericResponse>(Apiurl + "/upgrade");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,14 +9,14 @@ namespace Oqtane.Services
|
||||
{
|
||||
Task<List<Alias>> GetAliasesAsync();
|
||||
|
||||
Task<Alias> GetAliasAsync(int AliasId);
|
||||
Task<Alias> GetAliasAsync(int aliasId);
|
||||
|
||||
Task<Alias> GetAliasAsync(string Url, DateTime LastSyncDate);
|
||||
Task<Alias> GetAliasAsync(string url, DateTime lastSyncDate);
|
||||
|
||||
Task<Alias> AddAliasAsync(Alias Alias);
|
||||
Task<Alias> AddAliasAsync(Alias alias);
|
||||
|
||||
Task<Alias> UpdateAliasAsync(Alias Alias);
|
||||
Task<Alias> UpdateAliasAsync(Alias alias);
|
||||
|
||||
Task DeleteAliasAsync(int AliasId);
|
||||
Task DeleteAliasAsync(int aliasId);
|
||||
}
|
||||
}
|
||||
|
@ -6,16 +6,16 @@ namespace Oqtane.Services
|
||||
{
|
||||
public interface IFileService
|
||||
{
|
||||
Task<List<File>> GetFilesAsync(int FolderId);
|
||||
Task<List<File>> GetFilesAsync(string Folder);
|
||||
Task<File> GetFileAsync(int FileId);
|
||||
Task<File> AddFileAsync(File File);
|
||||
Task<File> UpdateFileAsync(File File);
|
||||
Task DeleteFileAsync(int FileId);
|
||||
Task<File> UploadFileAsync(string Url, int FolderId);
|
||||
Task<string> UploadFilesAsync(int FolderId, string[] Files, string FileUploadName);
|
||||
Task<string> UploadFilesAsync(string Folder, string[] Files, string FileUploadName);
|
||||
Task<byte[]> DownloadFileAsync(int FileId);
|
||||
Task<List<File>> GetFilesAsync(int folderId);
|
||||
Task<List<File>> GetFilesAsync(string folder);
|
||||
Task<File> GetFileAsync(int fileId);
|
||||
Task<File> AddFileAsync(File file);
|
||||
Task<File> UpdateFileAsync(File file);
|
||||
Task DeleteFileAsync(int fileId);
|
||||
Task<File> UploadFileAsync(string url, int folderId);
|
||||
Task<string> UploadFilesAsync(int folderId, string[] files, string fileUploadName);
|
||||
Task<string> UploadFilesAsync(string folder, string[] files, string fileUploadName);
|
||||
Task<byte[]> DownloadFileAsync(int fileId);
|
||||
|
||||
Task<List<File>> GetFilesAsync(int siteId, string folderPath);
|
||||
}
|
||||
|
@ -7,12 +7,12 @@ namespace Oqtane.Services
|
||||
{
|
||||
public interface IFolderService
|
||||
{
|
||||
Task<List<Folder>> GetFoldersAsync(int SiteId);
|
||||
Task<Folder> GetFolderAsync(int FolderId);
|
||||
Task<Folder> AddFolderAsync(Folder Folder);
|
||||
Task<Folder> UpdateFolderAsync(Folder Folder);
|
||||
Task UpdateFolderOrderAsync(int SiteId, int FolderId, int? ParentId);
|
||||
Task DeleteFolderAsync(int FolderId);
|
||||
Task<List<Folder>> GetFoldersAsync(int siteId);
|
||||
Task<Folder> GetFolderAsync(int folderId);
|
||||
Task<Folder> AddFolderAsync(Folder folder);
|
||||
Task<Folder> UpdateFolderAsync(Folder folder);
|
||||
Task UpdateFolderOrderAsync(int siteId, int folderId, int? parentId);
|
||||
Task DeleteFolderAsync(int folderId);
|
||||
Task<Folder> GetFolderAsync(int siteId, [NotNull]string folderPath);
|
||||
}
|
||||
}
|
||||
|
@ -8,12 +8,12 @@ namespace Oqtane.Services
|
||||
{
|
||||
Task<List<JobLog>> GetJobLogsAsync();
|
||||
|
||||
Task<JobLog> GetJobLogAsync(int JobLogId);
|
||||
Task<JobLog> GetJobLogAsync(int jobLogId);
|
||||
|
||||
Task<JobLog> AddJobLogAsync(JobLog JobLog);
|
||||
Task<JobLog> AddJobLogAsync(JobLog jobLog);
|
||||
|
||||
Task<JobLog> UpdateJobLogAsync(JobLog JobLog);
|
||||
Task<JobLog> UpdateJobLogAsync(JobLog jobLog);
|
||||
|
||||
Task DeleteJobLogAsync(int JobLogId);
|
||||
Task DeleteJobLogAsync(int jobLogId);
|
||||
}
|
||||
}
|
||||
|
@ -8,16 +8,16 @@ namespace Oqtane.Services
|
||||
{
|
||||
Task<List<Job>> GetJobsAsync();
|
||||
|
||||
Task<Job> GetJobAsync(int JobId);
|
||||
Task<Job> GetJobAsync(int jobId);
|
||||
|
||||
Task<Job> AddJobAsync(Job Job);
|
||||
Task<Job> AddJobAsync(Job job);
|
||||
|
||||
Task<Job> UpdateJobAsync(Job Job);
|
||||
Task<Job> UpdateJobAsync(Job job);
|
||||
|
||||
Task DeleteJobAsync(int JobId);
|
||||
Task DeleteJobAsync(int jobId);
|
||||
|
||||
Task StartJobAsync(int JobId);
|
||||
Task StartJobAsync(int jobId);
|
||||
|
||||
Task StopJobAsync(int JobId);
|
||||
Task StopJobAsync(int jobId);
|
||||
}
|
||||
}
|
||||
|
@ -3,14 +3,15 @@ using Oqtane.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Oqtane.Enums;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public interface ILogService
|
||||
{
|
||||
Task<List<Log>> GetLogsAsync(int SiteId, string Level, string Function, int Rows);
|
||||
Task<Log> GetLogAsync(int LogId);
|
||||
Task Log(int? PageId, int? ModuleId, int? UserId, string category, string feature, LogFunction function, LogLevel level, Exception exception, string message, params object[] args);
|
||||
Task Log(Alias Alias, int? PageId, int? ModuleId, int? UserId, string category, string feature, LogFunction function, LogLevel level, Exception exception, string message, params object[] args);
|
||||
Task<List<Log>> GetLogsAsync(int siteId, string level, string function, int rows);
|
||||
Task<Log> GetLogAsync(int logId);
|
||||
Task Log(int? pageId, int? moduleId, int? userId, string category, string feature, LogFunction function, LogLevel level, Exception exception, string message, params object[] args);
|
||||
Task Log(Alias alias, int? pageId, int? moduleId, int? userId, string category, string feature, LogFunction function, LogLevel level, Exception exception, string message, params object[] args);
|
||||
}
|
||||
}
|
||||
|
@ -6,11 +6,11 @@ namespace Oqtane.Services
|
||||
{
|
||||
public interface IModuleDefinitionService
|
||||
{
|
||||
Task<List<ModuleDefinition>> GetModuleDefinitionsAsync(int SiteId);
|
||||
Task<ModuleDefinition> GetModuleDefinitionAsync(int ModuleDefinitionId, int SiteId);
|
||||
Task UpdateModuleDefinitionAsync(ModuleDefinition ModuleDefinition);
|
||||
Task<List<ModuleDefinition>> GetModuleDefinitionsAsync(int siteId);
|
||||
Task<ModuleDefinition> GetModuleDefinitionAsync(int moduleDefinitionId, int siteId);
|
||||
Task UpdateModuleDefinitionAsync(ModuleDefinition moduleDefinition);
|
||||
Task InstallModuleDefinitionsAsync();
|
||||
Task DeleteModuleDefinitionAsync(int ModuleDefinitionId, int SiteId);
|
||||
Task LoadModuleDefinitionsAsync(int SiteId);
|
||||
Task DeleteModuleDefinitionAsync(int moduleDefinitionId, int siteId);
|
||||
Task LoadModuleDefinitionsAsync(int siteId);
|
||||
}
|
||||
}
|
||||
|
@ -6,12 +6,12 @@ namespace Oqtane.Services
|
||||
{
|
||||
public interface IModuleService
|
||||
{
|
||||
Task<List<Module>> GetModulesAsync(int SiteId);
|
||||
Task<Module> GetModuleAsync(int ModuleId);
|
||||
Task<Module> AddModuleAsync(Module Module);
|
||||
Task<Module> UpdateModuleAsync(Module Module);
|
||||
Task DeleteModuleAsync(int ModuleId);
|
||||
Task<bool> ImportModuleAsync(int ModuleId, string Content);
|
||||
Task<string> ExportModuleAsync(int ModuleId);
|
||||
Task<List<Module>> GetModulesAsync(int siteId);
|
||||
Task<Module> GetModuleAsync(int moduleId);
|
||||
Task<Module> AddModuleAsync(Module module);
|
||||
Task<Module> UpdateModuleAsync(Module module);
|
||||
Task DeleteModuleAsync(int moduleId);
|
||||
Task<bool> ImportModuleAsync(int moduleId, string content);
|
||||
Task<string> ExportModuleAsync(int moduleId);
|
||||
}
|
||||
}
|
||||
|
@ -6,14 +6,14 @@ namespace Oqtane.Services
|
||||
{
|
||||
public interface INotificationService
|
||||
{
|
||||
Task<List<Notification>> GetNotificationsAsync(int SiteId, string Direction, int UserId);
|
||||
Task<List<Notification>> GetNotificationsAsync(int siteId, string direction, int userId);
|
||||
|
||||
Task<Notification> GetNotificationAsync(int NotificationId);
|
||||
Task<Notification> GetNotificationAsync(int notificationId);
|
||||
|
||||
Task<Notification> AddNotificationAsync(Notification Notification);
|
||||
Task<Notification> AddNotificationAsync(Notification notification);
|
||||
|
||||
Task<Notification> UpdateNotificationAsync(Notification Notification);
|
||||
Task<Notification> UpdateNotificationAsync(Notification notification);
|
||||
|
||||
Task DeleteNotificationAsync(int NotificationId);
|
||||
Task DeleteNotificationAsync(int notificationId);
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ namespace Oqtane.Services
|
||||
{
|
||||
public interface IPackageService
|
||||
{
|
||||
Task<List<Package>> GetPackagesAsync(string Tag);
|
||||
Task DownloadPackageAsync(string PackageId, string Version, string Folder);
|
||||
Task<List<Package>> GetPackagesAsync(string tag);
|
||||
Task DownloadPackageAsync(string packageId, string version, string folder);
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,15 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public interface IPageModuleService
|
||||
{
|
||||
Task<PageModule> GetPageModuleAsync(int PageModuleId);
|
||||
Task<PageModule> GetPageModuleAsync(int PageId, int ModuleId);
|
||||
Task<PageModule> AddPageModuleAsync(PageModule PageModule);
|
||||
Task<PageModule> UpdatePageModuleAsync(PageModule PageModule);
|
||||
Task UpdatePageModuleOrderAsync(int PageId, string Pane);
|
||||
Task DeletePageModuleAsync(int PageModuleId);
|
||||
Task<PageModule> GetPageModuleAsync(int pageModuleId);
|
||||
Task<PageModule> GetPageModuleAsync(int pageId, int moduleId);
|
||||
Task<PageModule> AddPageModuleAsync(PageModule pageModule);
|
||||
Task<PageModule> UpdatePageModuleAsync(PageModule pageModule);
|
||||
Task UpdatePageModuleOrderAsync(int pageId, string pane);
|
||||
Task DeletePageModuleAsync(int pageModuleId);
|
||||
}
|
||||
}
|
||||
|
@ -6,14 +6,14 @@ namespace Oqtane.Services
|
||||
{
|
||||
public interface IPageService
|
||||
{
|
||||
Task<List<Page>> GetPagesAsync(int SiteId);
|
||||
Task<Page> GetPageAsync(int PageId);
|
||||
Task<Page> GetPageAsync(int PageId, int UserId);
|
||||
Task<Page> GetPageAsync(string Path, int SiteId);
|
||||
Task<Page> AddPageAsync(Page Page);
|
||||
Task<Page> AddPageAsync(int PageId, int UserId);
|
||||
Task<Page> UpdatePageAsync(Page Page);
|
||||
Task UpdatePageOrderAsync(int SiteId, int PageId, int? ParentId);
|
||||
Task DeletePageAsync(int PageId);
|
||||
Task<List<Page>> GetPagesAsync(int siteId);
|
||||
Task<Page> GetPageAsync(int pageId);
|
||||
Task<Page> GetPageAsync(int pageId, int userId);
|
||||
Task<Page> GetPageAsync(string path, int siteId);
|
||||
Task<Page> AddPageAsync(Page page);
|
||||
Task<Page> AddPageAsync(int pageId, int userId);
|
||||
Task<Page> UpdatePageAsync(Page page);
|
||||
Task UpdatePageOrderAsync(int siteId, int pageId, int? parentId);
|
||||
Task DeletePageAsync(int pageId);
|
||||
}
|
||||
}
|
||||
|
@ -6,14 +6,14 @@ namespace Oqtane.Services
|
||||
{
|
||||
public interface IProfileService
|
||||
{
|
||||
Task<List<Profile>> GetProfilesAsync(int SiteId);
|
||||
Task<List<Profile>> GetProfilesAsync(int siteId);
|
||||
|
||||
Task<Profile> GetProfileAsync(int ProfileId);
|
||||
Task<Profile> GetProfileAsync(int profileId);
|
||||
|
||||
Task<Profile> AddProfileAsync(Profile Profile);
|
||||
Task<Profile> AddProfileAsync(Profile profile);
|
||||
|
||||
Task<Profile> UpdateProfileAsync(Profile Profile);
|
||||
Task<Profile> UpdateProfileAsync(Profile profile);
|
||||
|
||||
Task DeleteProfileAsync(int ProfileId);
|
||||
Task DeleteProfileAsync(int profileId);
|
||||
}
|
||||
}
|
||||
|
@ -6,14 +6,14 @@ namespace Oqtane.Services
|
||||
{
|
||||
public interface IRoleService
|
||||
{
|
||||
Task<List<Role>> GetRolesAsync(int SiteId);
|
||||
Task<List<Role>> GetRolesAsync(int siteId);
|
||||
|
||||
Task<Role> GetRoleAsync(int RoleId);
|
||||
Task<Role> GetRoleAsync(int roleId);
|
||||
|
||||
Task<Role> AddRoleAsync(Role Role);
|
||||
Task<Role> AddRoleAsync(Role role);
|
||||
|
||||
Task<Role> UpdateRoleAsync(Role Role);
|
||||
Task<Role> UpdateRoleAsync(Role role);
|
||||
|
||||
Task DeleteRoleAsync(int RoleId);
|
||||
Task DeleteRoleAsync(int roleId);
|
||||
}
|
||||
}
|
||||
|
@ -8,48 +8,48 @@ namespace Oqtane.Services
|
||||
{
|
||||
Task<Dictionary<string, string>> GetHostSettingsAsync();
|
||||
|
||||
Task UpdateHostSettingsAsync(Dictionary<string, string> HostSettings);
|
||||
Task UpdateHostSettingsAsync(Dictionary<string, string> hostSettings);
|
||||
|
||||
Task<Dictionary<string, string>> GetSiteSettingsAsync(int SiteId);
|
||||
Task<Dictionary<string, string>> GetSiteSettingsAsync(int siteId);
|
||||
|
||||
Task UpdateSiteSettingsAsync(Dictionary<string, string> SiteSettings, int SiteId);
|
||||
Task UpdateSiteSettingsAsync(Dictionary<string, string> siteSettings, int siteId);
|
||||
|
||||
Task<Dictionary<string, string>> GetPageSettingsAsync(int PageId);
|
||||
Task<Dictionary<string, string>> GetPageSettingsAsync(int pageId);
|
||||
|
||||
Task UpdatePageSettingsAsync(Dictionary<string, string> PageSettings, int PageId);
|
||||
Task UpdatePageSettingsAsync(Dictionary<string, string> pageSettings, int pageId);
|
||||
|
||||
Task<Dictionary<string, string>> GetPageModuleSettingsAsync(int PageModuleId);
|
||||
Task<Dictionary<string, string>> GetPageModuleSettingsAsync(int pageModuleId);
|
||||
|
||||
Task UpdatePageModuleSettingsAsync(Dictionary<string, string> PageModuleSettings, int PageModuleId);
|
||||
Task UpdatePageModuleSettingsAsync(Dictionary<string, string> pageModuleSettings, int pageModuleId);
|
||||
|
||||
Task<Dictionary<string, string>> GetModuleSettingsAsync(int ModuleId);
|
||||
Task<Dictionary<string, string>> GetModuleSettingsAsync(int moduleId);
|
||||
|
||||
Task UpdateModuleSettingsAsync(Dictionary<string, string> ModuleSettings, int ModuleId);
|
||||
Task UpdateModuleSettingsAsync(Dictionary<string, string> moduleSettings, int moduleId);
|
||||
|
||||
Task<Dictionary<string, string>> GetUserSettingsAsync(int UserId);
|
||||
Task<Dictionary<string, string>> GetUserSettingsAsync(int userId);
|
||||
|
||||
Task UpdateUserSettingsAsync(Dictionary<string, string> UserSettings, int UserId);
|
||||
Task UpdateUserSettingsAsync(Dictionary<string, string> userSettings, int userId);
|
||||
|
||||
Task<Dictionary<string, string>> GetFolderSettingsAsync(int FolderId);
|
||||
Task<Dictionary<string, string>> GetFolderSettingsAsync(int folderId);
|
||||
|
||||
Task UpdateFolderSettingsAsync(Dictionary<string, string> FolderSettings, int FolderId);
|
||||
Task UpdateFolderSettingsAsync(Dictionary<string, string> folderSettings, int folderId);
|
||||
|
||||
Task<Dictionary<string, string>> GetSettingsAsync(string EntityName, int EntityId);
|
||||
Task<Dictionary<string, string>> GetSettingsAsync(string entityName, int entityId);
|
||||
|
||||
Task UpdateSettingsAsync(Dictionary<string, string> Settings, string EntityName, int EntityId);
|
||||
Task UpdateSettingsAsync(Dictionary<string, string> settings, string entityName, int entityId);
|
||||
|
||||
|
||||
Task<Setting> GetSettingAsync(int SettingId);
|
||||
Task<Setting> GetSettingAsync(int settingId);
|
||||
|
||||
Task<Setting> AddSettingAsync(Setting Setting);
|
||||
Task<Setting> AddSettingAsync(Setting setting);
|
||||
|
||||
Task<Setting> UpdateSettingAsync(Setting Setting);
|
||||
Task<Setting> UpdateSettingAsync(Setting setting);
|
||||
|
||||
Task DeleteSettingAsync(int SettingId);
|
||||
Task DeleteSettingAsync(int settingId);
|
||||
|
||||
|
||||
string GetSetting(Dictionary<string, string> Settings, string SettingName, string DefaultValue);
|
||||
string GetSetting(Dictionary<string, string> settings, string settingName, string defaultValue);
|
||||
|
||||
Dictionary<string, string> SetSetting(Dictionary<string, string> Settings, string SettingName, string SettingValue);
|
||||
Dictionary<string, string> SetSetting(Dictionary<string, string> settings, string settingName, string settingValue);
|
||||
}
|
||||
}
|
||||
|
@ -6,14 +6,14 @@ namespace Oqtane.Services
|
||||
{
|
||||
public interface ISiteService
|
||||
{
|
||||
Task<List<Site>> GetSitesAsync(Alias Alias);
|
||||
Task<List<Site>> GetSitesAsync(Alias alias);
|
||||
|
||||
Task<Site> GetSiteAsync(int SiteId, Alias Alias);
|
||||
Task<Site> GetSiteAsync(int siteId, Alias alias);
|
||||
|
||||
Task<Site> AddSiteAsync(Site Site, Alias Alias);
|
||||
Task<Site> AddSiteAsync(Site site, Alias alias);
|
||||
|
||||
Task<Site> UpdateSiteAsync(Site Site, Alias Alias);
|
||||
Task<Site> UpdateSiteAsync(Site site, Alias alias);
|
||||
|
||||
Task DeleteSiteAsync(int SiteId, Alias Alias);
|
||||
Task DeleteSiteAsync(int siteId, Alias alias);
|
||||
}
|
||||
}
|
||||
|
@ -8,12 +8,12 @@ namespace Oqtane.Services
|
||||
{
|
||||
Task<List<Tenant>> GetTenantsAsync();
|
||||
|
||||
Task<Tenant> GetTenantAsync(int TenantId);
|
||||
Task<Tenant> GetTenantAsync(int tenantId);
|
||||
|
||||
Task<Tenant> AddTenantAsync(Tenant Tenant);
|
||||
Task<Tenant> AddTenantAsync(Tenant tenant);
|
||||
|
||||
Task<Tenant> UpdateTenantAsync(Tenant Tenant);
|
||||
Task<Tenant> UpdateTenantAsync(Tenant tenant);
|
||||
|
||||
Task DeleteTenantAsync(int TenantId);
|
||||
Task DeleteTenantAsync(int tenantId);
|
||||
}
|
||||
}
|
||||
|
@ -7,10 +7,10 @@ namespace Oqtane.Services
|
||||
public interface IThemeService
|
||||
{
|
||||
Task<List<Theme>> GetThemesAsync();
|
||||
Dictionary<string, string> GetThemeTypes(List<Theme> Themes);
|
||||
Dictionary<string, string> GetPaneLayoutTypes(List<Theme> Themes, string ThemeName);
|
||||
Dictionary<string, string> GetContainerTypes(List<Theme> Themes);
|
||||
Dictionary<string, string> GetThemeTypes(List<Theme> themes);
|
||||
Dictionary<string, string> GetPaneLayoutTypes(List<Theme> themes, string themeName);
|
||||
Dictionary<string, string> GetContainerTypes(List<Theme> themes);
|
||||
Task InstallThemesAsync();
|
||||
Task DeleteThemeAsync(string ThemeName);
|
||||
Task DeleteThemeAsync(string themeName);
|
||||
}
|
||||
}
|
||||
|
@ -6,10 +6,10 @@ namespace Oqtane.Services
|
||||
{
|
||||
public interface IUserRoleService
|
||||
{
|
||||
Task<List<UserRole>> GetUserRolesAsync(int SiteId);
|
||||
Task<UserRole> GetUserRoleAsync(int UserRoleId);
|
||||
Task<UserRole> AddUserRoleAsync(UserRole UserRole);
|
||||
Task<UserRole> UpdateUserRoleAsync(UserRole UserRole);
|
||||
Task DeleteUserRoleAsync(int UserRoleId);
|
||||
Task<List<UserRole>> GetUserRolesAsync(int siteId);
|
||||
Task<UserRole> GetUserRoleAsync(int userRoleId);
|
||||
Task<UserRole> AddUserRoleAsync(UserRole userRole);
|
||||
Task<UserRole> UpdateUserRoleAsync(UserRole userRole);
|
||||
Task DeleteUserRoleAsync(int userRoleId);
|
||||
}
|
||||
}
|
||||
|
@ -1,31 +1,30 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public interface IUserService
|
||||
{
|
||||
Task<User> GetUserAsync(int UserId, int SiteId);
|
||||
Task<User> GetUserAsync(int userId, int siteId);
|
||||
|
||||
Task<User> GetUserAsync(string Username, int SiteId);
|
||||
Task<User> GetUserAsync(string username, int siteId);
|
||||
|
||||
Task<User> AddUserAsync(User User);
|
||||
Task<User> AddUserAsync(User user);
|
||||
|
||||
Task<User> AddUserAsync(User User, Alias Alias);
|
||||
Task<User> AddUserAsync(User user, Alias alias);
|
||||
|
||||
Task<User> UpdateUserAsync(User User);
|
||||
Task<User> UpdateUserAsync(User user);
|
||||
|
||||
Task DeleteUserAsync(int UserId);
|
||||
Task DeleteUserAsync(int userId);
|
||||
|
||||
Task<User> LoginUserAsync(User User, bool SetCookie, bool IsPersistent);
|
||||
Task<User> LoginUserAsync(User user, bool setCookie, bool isPersistent);
|
||||
|
||||
Task LogoutUserAsync(User User);
|
||||
Task LogoutUserAsync(User user);
|
||||
|
||||
Task<User> VerifyEmailAsync(User User, string Token);
|
||||
Task<User> VerifyEmailAsync(User user, string token);
|
||||
|
||||
Task ForgotPasswordAsync(User User);
|
||||
Task ForgotPasswordAsync(User user);
|
||||
|
||||
Task<User> ResetPasswordAsync(User User, string Token);
|
||||
Task<User> ResetPasswordAsync(User user, string token);
|
||||
}
|
||||
}
|
||||
|
@ -21,34 +21,34 @@ namespace Oqtane.Services
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "JobLog"); }
|
||||
}
|
||||
|
||||
public async Task<List<JobLog>> GetJobLogsAsync()
|
||||
{
|
||||
List<JobLog> Joblogs = await _http.GetJsonAsync<List<JobLog>>(apiurl);
|
||||
return Joblogs.OrderBy(item => item.StartDate).ToList();
|
||||
List<JobLog> joblogs = await _http.GetJsonAsync<List<JobLog>>(Apiurl);
|
||||
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 _http.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 _http.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 _http.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 _http.DeleteAsync(Apiurl + "/" + jobLogId.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,44 +21,44 @@ namespace Oqtane.Services
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Job"); }
|
||||
}
|
||||
|
||||
public async Task<List<Job>> GetJobsAsync()
|
||||
{
|
||||
List<Job> Jobs = await _http.GetJsonAsync<List<Job>>(apiurl);
|
||||
return Jobs.OrderBy(item => item.Name).ToList();
|
||||
List<Job> jobs = await _http.GetJsonAsync<List<Job>>(Apiurl);
|
||||
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 _http.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 _http.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 _http.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 _http.DeleteAsync(Apiurl + "/" + jobId.ToString());
|
||||
}
|
||||
|
||||
public async Task StartJobAsync(int JobId)
|
||||
public async Task StartJobAsync(int jobId)
|
||||
{
|
||||
await _http.GetAsync(apiurl + "/start/" + JobId.ToString());
|
||||
await _http.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 _http.GetAsync(Apiurl + "/stop/" + jobId.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ using System.Net.Http;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Oqtane.Enums;
|
||||
using Oqtane.Models;
|
||||
using Oqtane.Shared;
|
||||
|
||||
@ -22,40 +23,40 @@ namespace Oqtane.Services
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Log"); }
|
||||
}
|
||||
|
||||
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 _http.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 _http.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)
|
||||
{
|
||||
await Log(null, PageId, ModuleId, UserId, category, feature, function, level, exception, message, args);
|
||||
await Log(null, pageId, moduleId, userId, category, feature, function, level, exception, message, args);
|
||||
}
|
||||
|
||||
public async Task Log(Alias Alias, 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(Alias alias, int? pageId, int? moduleId, int? userId, string category, string feature, LogFunction function, LogLevel level, Exception exception, string message, params object[] args)
|
||||
{
|
||||
Log log = new Log();
|
||||
if (Alias == null)
|
||||
if (alias == null)
|
||||
{
|
||||
log.SiteId = _siteState.Alias.SiteId;
|
||||
}
|
||||
else
|
||||
{
|
||||
log.SiteId = Alias.SiteId;
|
||||
log.SiteId = alias.SiteId;
|
||||
}
|
||||
log.PageId = PageId;
|
||||
log.ModuleId = ModuleId;
|
||||
log.UserId = UserId;
|
||||
log.PageId = pageId;
|
||||
log.ModuleId = moduleId;
|
||||
log.UserId = userId;
|
||||
log.Url = _navigationManager.Uri;
|
||||
log.Category = category;
|
||||
log.Feature = feature;
|
||||
@ -68,7 +69,7 @@ namespace Oqtane.Services
|
||||
log.Message = message;
|
||||
log.MessageTemplate = "";
|
||||
log.Properties = JsonSerializer.Serialize(args);
|
||||
await _http.PostJsonAsync(CreateCrossTenantUrl(apiurl, Alias), log);
|
||||
await _http.PostJsonAsync(CreateCrossTenantUrl(Apiurl, alias), log);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,41 +26,41 @@ namespace Oqtane.Services
|
||||
_serviceProvider = serviceProvider;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "ModuleDefinition"); }
|
||||
}
|
||||
|
||||
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 _http.GetJsonAsync<List<ModuleDefinition>>(Apiurl + "?siteid=" + siteId.ToString());
|
||||
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 _http.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 _http.PutJsonAsync(Apiurl + "/" + moduleDefinition.ModuleDefinitionId.ToString(), moduleDefinition);
|
||||
}
|
||||
|
||||
public async Task InstallModuleDefinitionsAsync()
|
||||
{
|
||||
await _http.GetJsonAsync<List<string>>(apiurl + "/install");
|
||||
await _http.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 _http.DeleteAsync(Apiurl + "/" + moduleDefinitionId.ToString() + "?siteid=" + siteId.ToString());
|
||||
}
|
||||
|
||||
public async Task LoadModuleDefinitionsAsync(int SiteId)
|
||||
public async Task LoadModuleDefinitionsAsync(int siteId)
|
||||
{
|
||||
// get list of modules from the server
|
||||
List<ModuleDefinition> moduledefinitions = await GetModuleDefinitionsAsync(SiteId);
|
||||
List<ModuleDefinition> moduledefinitions = await GetModuleDefinitionsAsync(siteId);
|
||||
|
||||
// download assemblies to browser when running client-side Blazor
|
||||
var authstateprovider = (IdentityAuthenticationStateProvider)_serviceProvider.GetService(typeof(IdentityAuthenticationStateProvider));
|
||||
@ -80,7 +80,7 @@ namespace Oqtane.Services
|
||||
if (assemblies.Where(item => item.FullName.StartsWith(assemblyname + ",")).FirstOrDefault() == null)
|
||||
{
|
||||
// download assembly from server and load
|
||||
var bytes = await _http.GetByteArrayAsync(apiurl + "/load/" + assemblyname + ".dll");
|
||||
var bytes = await _http.GetByteArrayAsync(Apiurl + "/load/" + assemblyname + ".dll");
|
||||
Assembly.Load(bytes);
|
||||
}
|
||||
}
|
||||
@ -89,7 +89,7 @@ namespace Oqtane.Services
|
||||
if (assemblies.Where(item => item.FullName.StartsWith(moduledefinition.AssemblyName + ",")).FirstOrDefault() == null)
|
||||
{
|
||||
// download assembly from server and load
|
||||
var bytes = await _http.GetByteArrayAsync(apiurl + "/load/" + moduledefinition.AssemblyName + ".dll");
|
||||
var bytes = await _http.GetByteArrayAsync(Apiurl + "/load/" + moduledefinition.AssemblyName + ".dll");
|
||||
Assembly.Load(bytes);
|
||||
}
|
||||
}
|
||||
|
@ -21,48 +21,48 @@ namespace Oqtane.Services
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Module"); }
|
||||
}
|
||||
|
||||
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 _http.GetJsonAsync<List<Module>>(Apiurl + "?siteid=" + siteId.ToString());
|
||||
modules = modules
|
||||
.OrderBy(item => item.Order)
|
||||
.ToList();
|
||||
return modules;
|
||||
}
|
||||
|
||||
public async Task<Module> GetModuleAsync(int ModuleId)
|
||||
public async Task<Module> GetModuleAsync(int moduleId)
|
||||
{
|
||||
return await _http.GetJsonAsync<Module>(apiurl + "/" + ModuleId.ToString());
|
||||
return await _http.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 _http.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 _http.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 _http.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 _http.PostJsonAsync<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 _http.GetStringAsync(Apiurl + "/export?moduleid=" + moduleId.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,35 +21,35 @@ namespace Oqtane.Services
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Notification"); }
|
||||
}
|
||||
|
||||
public async Task<List<Notification>> GetNotificationsAsync(int SiteId, string Direction, int UserId)
|
||||
public async Task<List<Notification>> GetNotificationsAsync(int siteId, string direction, int userId)
|
||||
{
|
||||
string querystring = "?siteid=" + SiteId.ToString() + "&direction=" + Direction.ToLower() + "&userid=" + UserId.ToString();
|
||||
List<Notification> Notifications = await _http.GetJsonAsync<List<Notification>>(apiurl + querystring);
|
||||
return Notifications.OrderByDescending(item => item.CreatedOn).ToList();
|
||||
string querystring = "?siteid=" + siteId.ToString() + "&direction=" + direction.ToLower() + "&userid=" + userId.ToString();
|
||||
List<Notification> notifications = await _http.GetJsonAsync<List<Notification>>(Apiurl + querystring);
|
||||
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 _http.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 _http.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 _http.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 _http.DeleteAsync(Apiurl + "/" + notificationId.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,20 +21,20 @@ namespace Oqtane.Services
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Package"); }
|
||||
}
|
||||
|
||||
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 _http.GetJsonAsync<List<Package>>(Apiurl + "?tag=" + tag);
|
||||
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 _http.PostJsonAsync(Apiurl + "?packageid=" + packageId + "&version=" + version + "&folder=" + folder, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
@ -21,39 +19,39 @@ namespace Oqtane.Services
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "PageModule"); }
|
||||
}
|
||||
|
||||
public async Task<PageModule> GetPageModuleAsync(int PageModuleId)
|
||||
public async Task<PageModule> GetPageModuleAsync(int pageModuleId)
|
||||
{
|
||||
return await _http.GetJsonAsync<PageModule>(apiurl + "/" + PageModuleId.ToString());
|
||||
return await _http.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 _http.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 _http.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 _http.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 _http.PutJsonAsync(Apiurl + "/?pageid=" + pageId.ToString() + "&pane=" + pane, null);
|
||||
}
|
||||
|
||||
public async Task DeletePageModuleAsync(int PageModuleId)
|
||||
public async Task DeletePageModuleAsync(int pageModuleId)
|
||||
{
|
||||
await _http.DeleteAsync(apiurl + "/" + PageModuleId.ToString());
|
||||
await _http.DeleteAsync(Apiurl + "/" + pageModuleId.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,33 +23,33 @@ namespace Oqtane.Services
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Page"); }
|
||||
}
|
||||
|
||||
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 _http.GetJsonAsync<List<Page>>(Apiurl + "?siteid=" + siteId.ToString());
|
||||
pages = GetPagesHierarchy(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 _http.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 _http.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
|
||||
{
|
||||
return await _http.GetJsonAsync<Page>(apiurl + "/path/" + SiteId.ToString() + "?path=" + WebUtility.UrlEncode(Path));
|
||||
return await _http.GetJsonAsync<Page>(Apiurl + "/path/" + siteId.ToString() + "?path=" + WebUtility.UrlEncode(path));
|
||||
}
|
||||
catch
|
||||
{
|
||||
@ -57,62 +57,62 @@ 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 _http.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 _http.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 _http.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)
|
||||
{
|
||||
await _http.PutJsonAsync(apiurl + "/?siteid=" + SiteId.ToString() + "&pageid=" + PageId.ToString() + "&parentid=" + ((ParentId == null) ? "" : ParentId.ToString()), null);
|
||||
await _http.PutJsonAsync(Apiurl + "/?siteid=" + siteId.ToString() + "&pageid=" + pageId.ToString() + "&parentid=" + ((parentId == null) ? "" : parentId.ToString()), null);
|
||||
}
|
||||
|
||||
public async Task DeletePageAsync(int PageId)
|
||||
public async Task DeletePageAsync(int pageId)
|
||||
{
|
||||
await _http.DeleteAsync(apiurl + "/" + PageId.ToString());
|
||||
await _http.DeleteAsync(Apiurl + "/" + pageId.ToString());
|
||||
}
|
||||
|
||||
private static List<Page> GetPagesHierarchy(List<Page> Pages)
|
||||
private static List<Page> GetPagesHierarchy(List<Page> pages)
|
||||
{
|
||||
List<Page> hierarchy = new List<Page>();
|
||||
Action<List<Page>, Page> GetPath = null;
|
||||
GetPath = (List<Page> pages, Page page) =>
|
||||
Action<List<Page>, Page> getPath = null;
|
||||
getPath = (pageList, page) =>
|
||||
{
|
||||
IEnumerable<Page> children;
|
||||
int level;
|
||||
if (page == null)
|
||||
{
|
||||
level = -1;
|
||||
children = Pages.Where(item => item.ParentId == null);
|
||||
children = pages.Where(item => item.ParentId == null);
|
||||
}
|
||||
else
|
||||
{
|
||||
level = page.Level;
|
||||
children = Pages.Where(item => item.ParentId == page.PageId);
|
||||
children = pages.Where(item => item.ParentId == page.PageId);
|
||||
}
|
||||
foreach (Page child in children)
|
||||
{
|
||||
child.Level = level + 1;
|
||||
child.HasChildren = Pages.Where(item => item.ParentId == child.PageId).Any();
|
||||
child.HasChildren = pages.Any(item => item.ParentId == child.PageId);
|
||||
hierarchy.Add(child);
|
||||
GetPath(pages, child);
|
||||
getPath(pageList, child);
|
||||
}
|
||||
};
|
||||
Pages = Pages.OrderBy(item => item.Order).ToList();
|
||||
GetPath(Pages, null);
|
||||
pages = pages.OrderBy(item => item.Order).ToList();
|
||||
getPath(pages, null);
|
||||
|
||||
// add any non-hierarchical items to the end of the list
|
||||
foreach (Page page in Pages)
|
||||
foreach (Page page in pages)
|
||||
{
|
||||
if (hierarchy.Find(item => item.PageId == page.PageId) == null)
|
||||
{
|
||||
|
@ -21,34 +21,34 @@ namespace Oqtane.Services
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Profile"); }
|
||||
}
|
||||
|
||||
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());
|
||||
return Profiles.OrderBy(item => item.ViewOrder).ToList();
|
||||
List<Profile> profiles = await _http.GetJsonAsync<List<Profile>>(Apiurl + "?siteid=" + siteId.ToString());
|
||||
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 _http.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 _http.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 _http.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 _http.DeleteAsync(Apiurl + "/" + profileId.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,34 +21,34 @@ namespace Oqtane.Services
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Role"); }
|
||||
}
|
||||
|
||||
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());
|
||||
return Roles.OrderBy(item => item.Name).ToList();
|
||||
List<Role> roles = await _http.GetJsonAsync<List<Role>>(Apiurl + "?siteid=" + siteId.ToString());
|
||||
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 _http.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 _http.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 _http.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 _http.DeleteAsync(Apiurl + "/" + roleId.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace Oqtane.Services
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Setting"); }
|
||||
}
|
||||
@ -31,93 +31,93 @@ namespace Oqtane.Services
|
||||
return await GetSettingsAsync("Host", -1);
|
||||
}
|
||||
|
||||
public async Task UpdateHostSettingsAsync(Dictionary<string, string> HostSettings)
|
||||
public async Task UpdateHostSettingsAsync(Dictionary<string, string> hostSettings)
|
||||
{
|
||||
await UpdateSettingsAsync(HostSettings, "Host", -1);
|
||||
await UpdateSettingsAsync(hostSettings, "Host", -1);
|
||||
}
|
||||
|
||||
public async Task<Dictionary<string, string>> GetSiteSettingsAsync(int SiteId)
|
||||
public async Task<Dictionary<string, string>> GetSiteSettingsAsync(int siteId)
|
||||
{
|
||||
return await GetSettingsAsync("Site", SiteId);
|
||||
return await GetSettingsAsync("Site", siteId);
|
||||
}
|
||||
|
||||
public async Task UpdateSiteSettingsAsync(Dictionary<string, string> SiteSettings, int SiteId)
|
||||
public async Task UpdateSiteSettingsAsync(Dictionary<string, string> siteSettings, int siteId)
|
||||
{
|
||||
await UpdateSettingsAsync(SiteSettings, "Site", SiteId);
|
||||
await UpdateSettingsAsync(siteSettings, "Site", siteId);
|
||||
}
|
||||
|
||||
public async Task<Dictionary<string, string>> GetPageSettingsAsync(int PageId)
|
||||
public async Task<Dictionary<string, string>> GetPageSettingsAsync(int pageId)
|
||||
{
|
||||
return await GetSettingsAsync("Page", PageId);
|
||||
return await GetSettingsAsync("Page", pageId);
|
||||
}
|
||||
|
||||
public async Task UpdatePageSettingsAsync(Dictionary<string, string> PageSettings, int PageId)
|
||||
public async Task UpdatePageSettingsAsync(Dictionary<string, string> pageSettings, int pageId)
|
||||
{
|
||||
await UpdateSettingsAsync(PageSettings, "Page", PageId);
|
||||
await UpdateSettingsAsync(pageSettings, "Page", pageId);
|
||||
}
|
||||
|
||||
public async Task<Dictionary<string, string>> GetPageModuleSettingsAsync(int PageModuleId)
|
||||
public async Task<Dictionary<string, string>> GetPageModuleSettingsAsync(int pageModuleId)
|
||||
{
|
||||
return await GetSettingsAsync("PageModule", PageModuleId);
|
||||
return await GetSettingsAsync("PageModule", pageModuleId);
|
||||
}
|
||||
|
||||
public async Task UpdatePageModuleSettingsAsync(Dictionary<string, string> PageModuleSettings, int PageModuleId)
|
||||
public async Task UpdatePageModuleSettingsAsync(Dictionary<string, string> pageModuleSettings, int pageModuleId)
|
||||
{
|
||||
await UpdateSettingsAsync(PageModuleSettings, "PageModule", PageModuleId);
|
||||
await UpdateSettingsAsync(pageModuleSettings, "PageModule", pageModuleId);
|
||||
}
|
||||
|
||||
public async Task<Dictionary<string, string>> GetModuleSettingsAsync(int ModuleId)
|
||||
public async Task<Dictionary<string, string>> GetModuleSettingsAsync(int moduleId)
|
||||
{
|
||||
return await GetSettingsAsync("Module", ModuleId);
|
||||
return await GetSettingsAsync("Module", moduleId);
|
||||
}
|
||||
|
||||
public async Task UpdateModuleSettingsAsync(Dictionary<string, string> ModuleSettings, int ModuleId)
|
||||
public async Task UpdateModuleSettingsAsync(Dictionary<string, string> moduleSettings, int moduleId)
|
||||
{
|
||||
await UpdateSettingsAsync(ModuleSettings, "Module", ModuleId);
|
||||
await UpdateSettingsAsync(moduleSettings, "Module", moduleId);
|
||||
}
|
||||
|
||||
public async Task<Dictionary<string, string>> GetUserSettingsAsync(int UserId)
|
||||
public async Task<Dictionary<string, string>> GetUserSettingsAsync(int userId)
|
||||
{
|
||||
return await GetSettingsAsync("User", UserId);
|
||||
return await GetSettingsAsync("User", userId);
|
||||
}
|
||||
|
||||
public async Task UpdateUserSettingsAsync(Dictionary<string, string> UserSettings, int UserId)
|
||||
public async Task UpdateUserSettingsAsync(Dictionary<string, string> userSettings, int userId)
|
||||
{
|
||||
await UpdateSettingsAsync(UserSettings, "User", UserId);
|
||||
await UpdateSettingsAsync(userSettings, "User", userId);
|
||||
}
|
||||
|
||||
public async Task<Dictionary<string, string>> GetFolderSettingsAsync(int FolderId)
|
||||
public async Task<Dictionary<string, string>> GetFolderSettingsAsync(int folderId)
|
||||
{
|
||||
return await GetSettingsAsync("Folder", FolderId);
|
||||
return await GetSettingsAsync("Folder", folderId);
|
||||
}
|
||||
|
||||
public async Task UpdateFolderSettingsAsync(Dictionary<string, string> FolderSettings, int FolderId)
|
||||
public async Task UpdateFolderSettingsAsync(Dictionary<string, string> folderSettings, int folderId)
|
||||
{
|
||||
await UpdateSettingsAsync(FolderSettings, "Folder", FolderId);
|
||||
await UpdateSettingsAsync(folderSettings, "Folder", folderId);
|
||||
}
|
||||
|
||||
public async Task<Dictionary<string, string>> GetSettingsAsync(string EntityName, int EntityId)
|
||||
public async Task<Dictionary<string, string>> GetSettingsAsync(string entityName, int entityId)
|
||||
{
|
||||
Dictionary<string, string> dictionary = new Dictionary<string, string>();
|
||||
List<Setting> Settings = await _http.GetJsonAsync<List<Setting>>(apiurl + "?entityname=" + EntityName + "&entityid=" + EntityId.ToString());
|
||||
foreach(Setting setting in Settings.OrderBy(item => item.SettingName).ToList())
|
||||
List<Setting> settings = await _http.GetJsonAsync<List<Setting>>(Apiurl + "?entityname=" + entityName + "&entityid=" + entityId.ToString());
|
||||
foreach(Setting setting in settings.OrderBy(item => item.SettingName).ToList())
|
||||
{
|
||||
dictionary.Add(setting.SettingName, setting.SettingValue);
|
||||
}
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
public async Task UpdateSettingsAsync(Dictionary<string, string> Settings, string EntityName, int EntityId)
|
||||
public async Task UpdateSettingsAsync(Dictionary<string, string> settings, string entityName, int entityId)
|
||||
{
|
||||
List<Setting> settings = await _http.GetJsonAsync<List<Setting>>(apiurl + "?entityname=" + EntityName + "&entityid=" + EntityId.ToString());
|
||||
foreach (KeyValuePair<string, string> kvp in Settings)
|
||||
List<Setting> settingsList = await _http.GetJsonAsync<List<Setting>>(Apiurl + "?entityname=" + entityName + "&entityid=" + entityId.ToString());
|
||||
foreach (KeyValuePair<string, string> kvp in settings)
|
||||
{
|
||||
Setting setting = settings.Where(item => item.SettingName == kvp.Key).FirstOrDefault();
|
||||
Setting setting = settingsList.FirstOrDefault(item => item.SettingName == kvp.Key);
|
||||
if (setting == null)
|
||||
{
|
||||
setting = new Setting();
|
||||
setting.EntityName = EntityName;
|
||||
setting.EntityId = EntityId;
|
||||
setting.EntityName = entityName;
|
||||
setting.EntityId = entityId;
|
||||
setting.SettingName = kvp.Key;
|
||||
setting.SettingValue = kvp.Value;
|
||||
setting = await AddSettingAsync(setting);
|
||||
@ -134,48 +134,48 @@ 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 _http.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 _http.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 _http.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 _http.DeleteAsync(Apiurl + "/" + settingId.ToString());
|
||||
}
|
||||
|
||||
|
||||
public string GetSetting(Dictionary<string, string> Settings, string SettingName, string DefaultValue)
|
||||
public string GetSetting(Dictionary<string, string> settings, string settingName, string defaultValue)
|
||||
{
|
||||
string value = DefaultValue;
|
||||
if (Settings.ContainsKey(SettingName))
|
||||
string value = defaultValue;
|
||||
if (settings.ContainsKey(settingName))
|
||||
{
|
||||
value = Settings[SettingName];
|
||||
value = settings[settingName];
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public Dictionary<string, string> SetSetting(Dictionary<string, string> Settings, string SettingName, string SettingValue)
|
||||
public Dictionary<string, string> SetSetting(Dictionary<string, string> settings, string settingName, string settingValue)
|
||||
{
|
||||
if (Settings.ContainsKey(SettingName))
|
||||
if (settings.ContainsKey(settingName))
|
||||
{
|
||||
Settings[SettingName] = SettingValue;
|
||||
settings[settingName] = settingValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
Settings.Add(SettingName, SettingValue);
|
||||
settings.Add(settingName, settingValue);
|
||||
}
|
||||
return Settings;
|
||||
return settings;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,35 +21,35 @@ namespace Oqtane.Services
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Site"); }
|
||||
}
|
||||
|
||||
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 _http.GetJsonAsync<List<Site>>(CreateCrossTenantUrl(Apiurl, alias));
|
||||
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 _http.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 _http.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 _http.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 _http.DeleteAsync(CreateCrossTenantUrl(Apiurl + "/" + siteId.ToString(), alias));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,35 +21,35 @@ namespace Oqtane.Services
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Tenant"); }
|
||||
}
|
||||
|
||||
public async Task<List<Tenant>> GetTenantsAsync()
|
||||
{
|
||||
List<Tenant> tenants = await _http.GetJsonAsync<List<Tenant>>(apiurl);
|
||||
List<Tenant> tenants = await _http.GetJsonAsync<List<Tenant>>(Apiurl);
|
||||
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 _http.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 _http.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 _http.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 _http.DeleteAsync(Apiurl + "/" + tenantId.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,14 +23,14 @@ namespace Oqtane.Services
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Theme"); }
|
||||
}
|
||||
|
||||
public async Task<List<Theme>> GetThemesAsync()
|
||||
{
|
||||
List<Theme> themes = await _http.GetJsonAsync<List<Theme>>(apiurl);
|
||||
List<Theme> themes = await _http.GetJsonAsync<List<Theme>>(Apiurl);
|
||||
|
||||
// get list of loaded assemblies
|
||||
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||
@ -45,7 +45,7 @@ namespace Oqtane.Services
|
||||
if (assemblies.Where(item => item.FullName.StartsWith(assemblyname + ",")).FirstOrDefault() == null)
|
||||
{
|
||||
// download assembly from server and load
|
||||
var bytes = await _http.GetByteArrayAsync(apiurl + "/load/" + assemblyname + ".dll");
|
||||
var bytes = await _http.GetByteArrayAsync(Apiurl + "/load/" + assemblyname + ".dll");
|
||||
Assembly.Load(bytes);
|
||||
}
|
||||
}
|
||||
@ -53,7 +53,7 @@ namespace Oqtane.Services
|
||||
if (assemblies.Where(item => item.FullName.StartsWith(theme.AssemblyName + ",")).FirstOrDefault() == null)
|
||||
{
|
||||
// download assembly from server and load
|
||||
var bytes = await _http.GetByteArrayAsync(apiurl + "/load/" + theme.AssemblyName + ".dll");
|
||||
var bytes = await _http.GetByteArrayAsync(Apiurl + "/load/" + theme.AssemblyName + ".dll");
|
||||
Assembly.Load(bytes);
|
||||
}
|
||||
}
|
||||
@ -61,10 +61,10 @@ namespace Oqtane.Services
|
||||
return themes.OrderBy(item => item.Name).ToList();
|
||||
}
|
||||
|
||||
public Dictionary<string, string> GetThemeTypes(List<Theme> Themes)
|
||||
public Dictionary<string, string> GetThemeTypes(List<Theme> themes)
|
||||
{
|
||||
var selectableThemes = new Dictionary<string, string>();
|
||||
foreach (Theme theme in Themes)
|
||||
foreach (Theme theme in themes)
|
||||
{
|
||||
foreach (string themecontrol in theme.ThemeControls.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
@ -74,12 +74,12 @@ namespace Oqtane.Services
|
||||
return selectableThemes;
|
||||
}
|
||||
|
||||
public Dictionary<string, string> GetPaneLayoutTypes(List<Theme> Themes, string ThemeName)
|
||||
public Dictionary<string, string> GetPaneLayoutTypes(List<Theme> themes, string themeName)
|
||||
{
|
||||
var selectablePaneLayouts = new Dictionary<string, string>();
|
||||
foreach (Theme theme in Themes)
|
||||
foreach (Theme theme in themes)
|
||||
{
|
||||
if (ThemeName.StartsWith(theme.ThemeName))
|
||||
if (themeName.StartsWith(theme.ThemeName))
|
||||
{
|
||||
foreach (string panelayout in theme.PaneLayouts.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
@ -90,10 +90,10 @@ namespace Oqtane.Services
|
||||
return selectablePaneLayouts;
|
||||
}
|
||||
|
||||
public Dictionary<string, string> GetContainerTypes(List<Theme> Themes)
|
||||
public Dictionary<string, string> GetContainerTypes(List<Theme> themes)
|
||||
{
|
||||
var selectableContainers = new Dictionary<string, string>();
|
||||
foreach (Theme theme in Themes)
|
||||
foreach (Theme theme in themes)
|
||||
{
|
||||
foreach (string container in theme.ContainerControls.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
@ -105,12 +105,12 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task InstallThemesAsync()
|
||||
{
|
||||
await _http.GetJsonAsync<List<string>>(apiurl + "/install");
|
||||
await _http.GetJsonAsync<List<string>>(Apiurl + "/install");
|
||||
}
|
||||
|
||||
public async Task DeleteThemeAsync(string ThemeName)
|
||||
public async Task DeleteThemeAsync(string themeName)
|
||||
{
|
||||
await _http.DeleteAsync(apiurl + "/" + ThemeName);
|
||||
await _http.DeleteAsync(Apiurl + "/" + themeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
@ -21,34 +20,34 @@ namespace Oqtane.Services
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "UserRole"); }
|
||||
}
|
||||
|
||||
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 _http.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 _http.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 _http.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 _http.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 _http.DeleteAsync(Apiurl + "/" + userRoleId.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,26 +19,26 @@ namespace Oqtane.Services
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "User"); }
|
||||
}
|
||||
|
||||
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 _http.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 _http.GetJsonAsync<User>(Apiurl + "/name/" + username + "?siteid=" + siteId.ToString());
|
||||
}
|
||||
|
||||
public async Task<User> AddUserAsync(User User)
|
||||
public async Task<User> AddUserAsync(User user)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await _http.PostJsonAsync<User>(apiurl, User);
|
||||
return await _http.PostJsonAsync<User>(Apiurl, user);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@ -46,11 +46,11 @@ namespace Oqtane.Services
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<User> AddUserAsync(User User, Alias Alias)
|
||||
public async Task<User> AddUserAsync(User user, Alias alias)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await _http.PostJsonAsync<User>(CreateCrossTenantUrl(apiurl, Alias), User);
|
||||
return await _http.PostJsonAsync<User>(CreateCrossTenantUrl(Apiurl, alias), user);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@ -58,39 +58,39 @@ 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 _http.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 _http.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 _http.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
|
||||
await _http.PostJsonAsync(apiurl + "/logout", User);
|
||||
await _http.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 _http.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 _http.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 _http.PostJsonAsync<User>(Apiurl + "/reset?token=" + token, user);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user