Initial commit
This commit is contained in:
46
Oqtane.Client/Modules/Admin/Sites/Add.razor
Normal file
46
Oqtane.Client/Modules/Admin/Sites/Add.razor
Normal file
@ -0,0 +1,46 @@
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Oqtane.Models
|
||||
@using Oqtane.Services
|
||||
@using Oqtane.Modules
|
||||
@using Oqtane.Client.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@inject IUriHelper UriHelper
|
||||
@inject ISiteService SiteService
|
||||
|
||||
<table class="form-group">
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Name: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" bind="@name" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Alias: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" bind="@alias" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button class="btn btn-success" onclick="@SaveSite">Save</button>
|
||||
<NavLink class="btn btn" href="@NavigateUrl()">Cancel</NavLink>
|
||||
|
||||
@functions {
|
||||
public override SecurityAccessLevelEnum SecurityAccessLevel { get { return SecurityAccessLevelEnum.Host; } }
|
||||
|
||||
string name;
|
||||
string alias;
|
||||
|
||||
private async Task SaveSite()
|
||||
{
|
||||
Site site = new Site();
|
||||
site.Name = name;
|
||||
site.Logo = "";
|
||||
await SiteService.AddSiteAsync(site);
|
||||
StateHasChanged();
|
||||
UriHelper.NavigateTo(NavigateUrl());
|
||||
}
|
||||
}
|
42
Oqtane.Client/Modules/Admin/Sites/Index.razor
Normal file
42
Oqtane.Client/Modules/Admin/Sites/Index.razor
Normal file
@ -0,0 +1,42 @@
|
||||
@using Oqtane.Services
|
||||
@using Oqtane.Models
|
||||
@using Oqtane.Modules
|
||||
@using Oqtane.Client.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
|
||||
@inject ISiteService SiteService
|
||||
|
||||
@if (sites == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var site in sites)
|
||||
{
|
||||
<tr>
|
||||
<td>@site.Name</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<ActionLink Action="Add" Text="Add Site" />
|
||||
}
|
||||
|
||||
@functions {
|
||||
public override SecurityAccessLevelEnum SecurityAccessLevel { get { return SecurityAccessLevelEnum.Host; } }
|
||||
|
||||
List<Site> sites;
|
||||
|
||||
protected override async Task OnInitAsync()
|
||||
{
|
||||
sites = await SiteService.GetSitesAsync();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user