Simplified User Delete page
This commit is contained in:
parent
7b4eee4d0c
commit
5fd4d69034
@ -5,7 +5,7 @@
|
|||||||
@inject IProfileService ProfileService
|
@inject IProfileService ProfileService
|
||||||
@inject ISettingService SettingService
|
@inject ISettingService SettingService
|
||||||
|
|
||||||
@if (profiles != null)
|
@if (!string.IsNullOrWhiteSpace(username))
|
||||||
{
|
{
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
@ -13,7 +13,7 @@
|
|||||||
<label for="Name" class="control-label">Username: </label>
|
<label for="Name" class="control-label">Username: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@username" readonly />
|
<input class="form-control" @bind="@username" disabled />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -21,7 +21,7 @@
|
|||||||
<label for="Name" class="control-label">Email: </label>
|
<label for="Name" class="control-label">Email: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@email" readonly />
|
<input class="form-control" @bind="@email" disabled />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -29,34 +29,26 @@
|
|||||||
<label for="Name" class="control-label">Full Name: </label>
|
<label for="Name" class="control-label">Full Name: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@displayname" readonly />
|
<input class="form-control" @bind="@displayname" disabled />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Name" class="control-label">Is Deleted? </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select class="form-control" @bind="@isdeleted" disabled>
|
||||||
|
<option value="True">Yes</option>
|
||||||
|
<option value="False">No</option>
|
||||||
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@foreach (Profile profile in profiles)
|
|
||||||
{
|
|
||||||
var p = profile;
|
|
||||||
if (p.Category != category)
|
|
||||||
{
|
|
||||||
<tr>
|
|
||||||
<th colspan="2" style="text-align: center;">
|
|
||||||
@p.Category
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
category = p.Category;
|
|
||||||
}
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<label for="@p.Name" class="control-label">@p.Title: </label>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<input class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" readonly />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</table>
|
</table>
|
||||||
<button type="button" class="btn btn-primary" @onclick="DeleteUser">Delete</button>
|
<button type="button" class="btn btn-primary" @onclick="DeleteUser">Delete</button>
|
||||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<AuditInfo CreatedBy="@createdby" CreatedOn="@createdon" ModifiedBy="@modifiedby" ModifiedOn="@modifiedon" DeletedBy="@deletedby" DeletedOn="@deletedon"></AuditInfo>
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
@ -66,16 +58,19 @@
|
|||||||
string username = "";
|
string username = "";
|
||||||
string email = "";
|
string email = "";
|
||||||
string displayname = "";
|
string displayname = "";
|
||||||
List<Profile> profiles;
|
|
||||||
Dictionary<string, string> settings;
|
|
||||||
string category = "";
|
string category = "";
|
||||||
|
string createdby;
|
||||||
|
DateTime createdon;
|
||||||
|
string modifiedby;
|
||||||
|
DateTime modifiedon;
|
||||||
|
string deletedby;
|
||||||
|
DateTime? deletedon;
|
||||||
|
string isdeleted;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
profiles = await ProfileService.GetProfilesAsync(PageState.Site.SiteId);
|
|
||||||
|
|
||||||
userid = Int32.Parse(PageState.QueryString["id"]);
|
userid = Int32.Parse(PageState.QueryString["id"]);
|
||||||
User user = await UserService.GetUserAsync(userid, PageState.Site.SiteId);
|
User user = await UserService.GetUserAsync(userid, PageState.Site.SiteId);
|
||||||
if (user != null)
|
if (user != null)
|
||||||
@ -83,7 +78,13 @@
|
|||||||
username = user.Username;
|
username = user.Username;
|
||||||
email = user.Email;
|
email = user.Email;
|
||||||
displayname = user.DisplayName;
|
displayname = user.DisplayName;
|
||||||
settings = await SettingService.GetUserSettingsAsync(user.UserId);
|
createdby = user.CreatedBy;
|
||||||
|
createdon = user.CreatedOn;
|
||||||
|
modifiedby = user.ModifiedBy;
|
||||||
|
modifiedon = user.ModifiedOn;
|
||||||
|
deletedby = user.DeletedBy;
|
||||||
|
deletedon = user.DeletedOn;
|
||||||
|
isdeleted = user.IsDeleted.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -92,11 +93,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetProfileValue(string SettingName, string DefaultValue)
|
|
||||||
{
|
|
||||||
return SettingService.GetSetting(settings, SettingName, DefaultValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task DeleteUser()
|
private async Task DeleteUser()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
Reference in New Issue
Block a user