Compare commits
1
Commits
v0.1.3
..
3a427f40ed
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a427f40ed |
No files matched your search
@@ -54,7 +54,7 @@
|
|||||||
private HttpContext HttpContext { get; set; } = default!;
|
private HttpContext HttpContext { get; set; } = default!;
|
||||||
|
|
||||||
[SupplyParameterFromForm]
|
[SupplyParameterFromForm]
|
||||||
private InputModel Input { get; set; } = null!;
|
private InputModel Input { get; set; } = new();
|
||||||
|
|
||||||
[SupplyParameterFromQuery]
|
[SupplyParameterFromQuery]
|
||||||
private string? RemoteError { get; set; }
|
private string? RemoteError { get; set; }
|
||||||
@@ -94,8 +94,6 @@
|
|||||||
// the login page if we get here some other way.
|
// the login page if we get here some other way.
|
||||||
RedirectManager.RedirectTo("Account/Login");
|
RedirectManager.RedirectTo("Account/Login");
|
||||||
}
|
}
|
||||||
|
|
||||||
Input ??= new InputModel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OnLoginCallbackAsync()
|
private async Task OnLoginCallbackAsync()
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
@code {
|
@code {
|
||||||
[SupplyParameterFromForm]
|
[SupplyParameterFromForm]
|
||||||
private InputModel Input { get; set; } = null!;
|
private InputModel Input { get; set; } = new();
|
||||||
|
|
||||||
private async Task OnValidSubmitAsync()
|
private async Task OnValidSubmitAsync()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
@* MudTextFields zwingend mit Name-Attribut für SSR *@
|
@* MudTextFields zwingend mit Name-Attribut für SSR *@
|
||||||
<MudTextField @bind-Value="Input.Username"
|
<MudTextField @bind-Value="Input.Username"
|
||||||
For="@(() => Input.Username)"
|
For="@(() => Input.Username)"
|
||||||
name="Input.Username"
|
Name="Input.Username"
|
||||||
Label="Username"
|
Label="Username"
|
||||||
Variant="Variant.Outlined"
|
Variant="Variant.Outlined"
|
||||||
Margin="Margin.Dense"
|
Margin="Margin.Dense"
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
<MudTextField @bind-Value="Input.Password"
|
<MudTextField @bind-Value="Input.Password"
|
||||||
For="@(() => Input.Password)"
|
For="@(() => Input.Password)"
|
||||||
name="Input.Password"
|
Name="Input.Password"
|
||||||
Label="Password"
|
Label="Password"
|
||||||
InputType="InputType.Password"
|
InputType="InputType.Password"
|
||||||
Variant="Variant.Outlined"
|
Variant="Variant.Outlined"
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
private HttpContext HttpContext { get; set; } = default!;
|
private HttpContext HttpContext { get; set; } = default!;
|
||||||
|
|
||||||
[SupplyParameterFromForm]
|
[SupplyParameterFromForm]
|
||||||
private InputModel Input { get; set; } = null!;
|
private InputModel Input { get; set; } = new();
|
||||||
|
|
||||||
[SupplyParameterFromQuery]
|
[SupplyParameterFromQuery]
|
||||||
private string? ReturnUrl { get; set; }
|
private string? ReturnUrl { get; set; }
|
||||||
@@ -87,8 +87,6 @@
|
|||||||
// Clear the existing external cookie to ensure a clean login process
|
// Clear the existing external cookie to ensure a clean login process
|
||||||
await HttpContext.SignOutAsync(IdentityConstants.ExternalScheme);
|
await HttpContext.SignOutAsync(IdentityConstants.ExternalScheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
Input ??= new InputModel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task LoginUser()
|
public async Task LoginUser()
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
private ApplicationUser user = default!;
|
private ApplicationUser user = default!;
|
||||||
|
|
||||||
[SupplyParameterFromForm]
|
[SupplyParameterFromForm]
|
||||||
private InputModel Input { get; set; } = null!;
|
private InputModel Input { get; set; } = new();
|
||||||
|
|
||||||
[SupplyParameterFromQuery]
|
[SupplyParameterFromQuery]
|
||||||
private string? ReturnUrl { get; set; }
|
private string? ReturnUrl { get; set; }
|
||||||
@@ -62,8 +62,6 @@
|
|||||||
// Ensure the user has gone through the username & password screen first
|
// Ensure the user has gone through the username & password screen first
|
||||||
user = await SignInManager.GetTwoFactorAuthenticationUserAsync() ??
|
user = await SignInManager.GetTwoFactorAuthenticationUserAsync() ??
|
||||||
throw new InvalidOperationException("Unable to load two-factor authentication user.");
|
throw new InvalidOperationException("Unable to load two-factor authentication user.");
|
||||||
|
|
||||||
Input ??= new InputModel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OnValidSubmitAsync()
|
private async Task OnValidSubmitAsync()
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
private ApplicationUser user = default!;
|
private ApplicationUser user = default!;
|
||||||
|
|
||||||
[SupplyParameterFromForm]
|
[SupplyParameterFromForm]
|
||||||
private InputModel Input { get; set; } = null!;
|
private InputModel Input { get; set; } = new();
|
||||||
|
|
||||||
[SupplyParameterFromQuery]
|
[SupplyParameterFromQuery]
|
||||||
private string? ReturnUrl { get; set; }
|
private string? ReturnUrl { get; set; }
|
||||||
@@ -48,8 +48,6 @@
|
|||||||
// Ensure the user has gone through the username & password screen first
|
// Ensure the user has gone through the username & password screen first
|
||||||
user = await SignInManager.GetTwoFactorAuthenticationUserAsync() ??
|
user = await SignInManager.GetTwoFactorAuthenticationUserAsync() ??
|
||||||
throw new InvalidOperationException("Unable to load two-factor authentication user.");
|
throw new InvalidOperationException("Unable to load two-factor authentication user.");
|
||||||
|
|
||||||
Input ??= new InputModel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OnValidSubmitAsync()
|
private async Task OnValidSubmitAsync()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@page "/Account/ChangePassword"
|
@page "/Account/Manage/ChangePassword"
|
||||||
|
|
||||||
@using System.ComponentModel.DataAnnotations
|
@using System.ComponentModel.DataAnnotations
|
||||||
@using Microsoft.AspNetCore.Identity
|
@using Microsoft.AspNetCore.Identity
|
||||||
@@ -9,81 +9,67 @@
|
|||||||
@inject IdentityUserAccessor UserAccessor
|
@inject IdentityUserAccessor UserAccessor
|
||||||
@inject IdentityRedirectManager RedirectManager
|
@inject IdentityRedirectManager RedirectManager
|
||||||
@inject ILogger<ChangePassword> Logger
|
@inject ILogger<ChangePassword> Logger
|
||||||
@inject ISnackbar Snackbar
|
|
||||||
|
|
||||||
<PageTitle>Change password</PageTitle>
|
<PageTitle>Change password</PageTitle>
|
||||||
|
|
||||||
<MudText Typo="Typo.h6">Change password</MudText>
|
<h3>Change password</h3>
|
||||||
|
<StatusMessage Message="@message" />
|
||||||
<EditForm Model="Input" FormName="change-password" OnValidSubmit="OnValidSubmitAsync" method="post">
|
<div class="row">
|
||||||
|
<div class="col-xl-6">
|
||||||
<MudTextField
|
<EditForm Model="Input" FormName="change-password" OnValidSubmit="OnValidSubmitAsync" method="post">
|
||||||
T="string"
|
<DataAnnotationsValidator />
|
||||||
name="Input.OldPassword"
|
<ValidationSummary class="text-danger" role="alert" />
|
||||||
Label="OldPassword"
|
<div class="form-floating mb-3">
|
||||||
@bind-Value="Input.OldPassword"
|
<InputText type="password" @bind-Value="Input.OldPassword" id="Input.OldPassword" class="form-control" autocomplete="current-password" aria-required="true" placeholder="Enter the old password" />
|
||||||
For="@(() => Input.OldPassword)"
|
<label for="Input.OldPassword" class="form-label">Old password</label>
|
||||||
InputType="InputType.Password"
|
<ValidationMessage For="() => Input.OldPassword" class="text-danger" />
|
||||||
Required="true"
|
</div>
|
||||||
Variant="Variant.Outlined"
|
<div class="form-floating mb-3">
|
||||||
ShrinkLabel="true"/>
|
<InputText type="password" @bind-Value="Input.NewPassword" id="Input.NewPassword" class="form-control" autocomplete="new-password" aria-required="true" placeholder="Enter the new password" />
|
||||||
|
<label for="Input.NewPassword" class="form-label">New password</label>
|
||||||
<MudTextField
|
<ValidationMessage For="() => Input.NewPassword" class="text-danger" />
|
||||||
T="string"
|
</div>
|
||||||
name="Input.NewPassword"
|
<div class="form-floating mb-3">
|
||||||
Label="New password"
|
<InputText type="password" @bind-Value="Input.ConfirmPassword" id="Input.ConfirmPassword" class="form-control" autocomplete="new-password" aria-required="true" placeholder="Enter the new password" />
|
||||||
@bind-Value="Input.NewPassword"
|
<label for="Input.ConfirmPassword" class="form-label">Confirm password</label>
|
||||||
For="@(() => Input.NewPassword)"
|
<ValidationMessage For="() => Input.ConfirmPassword" class="text-danger" />
|
||||||
InputType="InputType.Password"
|
</div>
|
||||||
Required="true"
|
<button type="submit" class="w-100 btn btn-lg btn-primary">Update password</button>
|
||||||
Variant="Variant.Outlined"
|
</EditForm>
|
||||||
ShrinkLabel="true"/>
|
</div>
|
||||||
|
</div>
|
||||||
<MudTextField
|
|
||||||
T="string"
|
|
||||||
name="Input.ConfirmPassword"
|
|
||||||
Label="Confirm password"
|
|
||||||
@bind-Value="Input.ConfirmPassword"
|
|
||||||
For="@(() => Input.ConfirmPassword)"
|
|
||||||
InputType="InputType.Password"
|
|
||||||
Required="true"
|
|
||||||
Variant="Variant.Outlined"
|
|
||||||
ShrinkLabel="true"/>
|
|
||||||
|
|
||||||
<MudButton ButtonType="ButtonType.Submit" Variant="Variant.Filled" Color="Color.Primary">Change password</MudButton>
|
|
||||||
</EditForm>
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private ApplicationUser _user = null!;
|
private string? message;
|
||||||
private bool _hasPassword;
|
private ApplicationUser user = default!;
|
||||||
|
private bool hasPassword;
|
||||||
|
|
||||||
[CascadingParameter]
|
[CascadingParameter]
|
||||||
private HttpContext HttpContext { get; set; } = null!;
|
private HttpContext HttpContext { get; set; } = default!;
|
||||||
|
|
||||||
[SupplyParameterFromForm]
|
[SupplyParameterFromForm]
|
||||||
private InputModel Input { get; set; } = null!;
|
private InputModel Input { get; set; } = new();
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
_user = await UserAccessor.GetRequiredUserAsync(HttpContext);
|
user = await UserAccessor.GetRequiredUserAsync(HttpContext);
|
||||||
_hasPassword = await UserManager.HasPasswordAsync(_user);
|
hasPassword = await UserManager.HasPasswordAsync(user);
|
||||||
if (!_hasPassword)
|
if (!hasPassword)
|
||||||
{
|
{
|
||||||
RedirectManager.RedirectTo("Account/Manage/SetPassword");
|
RedirectManager.RedirectTo("Account/Manage/SetPassword");
|
||||||
}
|
}
|
||||||
Input ??= new InputModel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OnValidSubmitAsync()
|
private async Task OnValidSubmitAsync()
|
||||||
{
|
{
|
||||||
var changePasswordResult = await UserManager.ChangePasswordAsync(_user, Input.OldPassword, Input.NewPassword);
|
var changePasswordResult = await UserManager.ChangePasswordAsync(user, Input.OldPassword, Input.NewPassword);
|
||||||
if (!changePasswordResult.Succeeded)
|
if (!changePasswordResult.Succeeded)
|
||||||
{
|
{
|
||||||
|
message = $"Error: {string.Join(",", changePasswordResult.Errors.Select(error => error.Description))}";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await SignInManager.RefreshSignInAsync(_user);
|
await SignInManager.RefreshSignInAsync(user);
|
||||||
Logger.LogInformation("User changed their password successfully.");
|
Logger.LogInformation("User changed their password successfully.");
|
||||||
|
|
||||||
RedirectManager.RedirectToCurrentPageWithStatus("Your password has been changed", HttpContext);
|
RedirectManager.RedirectToCurrentPageWithStatus("Your password has been changed", HttpContext);
|
||||||
|
|||||||
@@ -47,15 +47,13 @@
|
|||||||
private HttpContext HttpContext { get; set; } = default!;
|
private HttpContext HttpContext { get; set; } = default!;
|
||||||
|
|
||||||
[SupplyParameterFromForm]
|
[SupplyParameterFromForm]
|
||||||
private InputModel Input { get; set; } = null!;
|
private InputModel Input { get; set; } = new();
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
Input ??= new();
|
Input ??= new();
|
||||||
user = await UserAccessor.GetRequiredUserAsync(HttpContext);
|
user = await UserAccessor.GetRequiredUserAsync(HttpContext);
|
||||||
requirePassword = await UserManager.HasPasswordAsync(user);
|
requirePassword = await UserManager.HasPasswordAsync(user);
|
||||||
|
|
||||||
Input ??= new InputModel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OnValidSubmitAsync()
|
private async Task OnValidSubmitAsync()
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
private HttpContext HttpContext { get; set; } = default!;
|
private HttpContext HttpContext { get; set; } = default!;
|
||||||
|
|
||||||
[SupplyParameterFromForm(FormName = "change-email")]
|
[SupplyParameterFromForm(FormName = "change-email")]
|
||||||
private InputModel Input { get; set; } = null!;
|
private InputModel Input { get; set; } = new();
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
@@ -72,7 +72,6 @@
|
|||||||
isEmailConfirmed = await UserManager.IsEmailConfirmedAsync(user);
|
isEmailConfirmed = await UserManager.IsEmailConfirmedAsync(user);
|
||||||
|
|
||||||
Input.NewEmail ??= email;
|
Input.NewEmail ??= email;
|
||||||
Input ??= new InputModel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OnValidSubmitAsync()
|
private async Task OnValidSubmitAsync()
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ else
|
|||||||
private HttpContext HttpContext { get; set; } = default!;
|
private HttpContext HttpContext { get; set; } = default!;
|
||||||
|
|
||||||
[SupplyParameterFromForm]
|
[SupplyParameterFromForm]
|
||||||
private InputModel Input { get; set; } = null!;
|
private InputModel Input { get; set; } = new();
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,14 +11,27 @@
|
|||||||
|
|
||||||
<PageTitle>Profile</PageTitle>
|
<PageTitle>Profile</PageTitle>
|
||||||
|
|
||||||
<MudText Typo="Typo.h6">Profile</MudText>
|
<h3>Profile</h3>
|
||||||
<StatusMessage />
|
<StatusMessage />
|
||||||
|
|
||||||
<MudContainer Class="pa-0 ma-0">
|
<div class="row">
|
||||||
<MudTextField Value="@username" Variant="Variant.Outlined" Label="Username"/>
|
<div class="col-xl-6">
|
||||||
</MudContainer>
|
<EditForm Model="Input" FormName="profile" OnValidSubmit="OnValidSubmitAsync" method="post">
|
||||||
|
<DataAnnotationsValidator />
|
||||||
|
<ValidationSummary class="text-danger" role="alert" />
|
||||||
|
<div class="form-floating mb-3">
|
||||||
|
<input type="text" value="@username" id="username" class="form-control" placeholder="Choose your username." disabled />
|
||||||
|
<label for="username" class="form-label">Username</label>
|
||||||
|
</div>
|
||||||
|
<!--<div class="form-floating mb-3">
|
||||||
|
<InputText @bind-Value="Input.PhoneNumber" id="Input.PhoneNumber" class="form-control" placeholder="Enter your phone number" />
|
||||||
|
<label for="Input.PhoneNumber" class="form-label">Phone number</label>
|
||||||
|
<ValidationMessage For="() => Input.PhoneNumber" class="text-danger" />
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="w-100 btn btn-lg btn-primary">Save</button>-->
|
||||||
|
</EditForm>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private ApplicationUser user = default!;
|
private ApplicationUser user = default!;
|
||||||
@@ -29,7 +42,7 @@
|
|||||||
private HttpContext HttpContext { get; set; } = default!;
|
private HttpContext HttpContext { get; set; } = default!;
|
||||||
|
|
||||||
[SupplyParameterFromForm]
|
[SupplyParameterFromForm]
|
||||||
private InputModel Input { get; set; } = null!;
|
private InputModel Input { get; set; } = new();
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
private HttpContext HttpContext { get; set; } = default!;
|
private HttpContext HttpContext { get; set; } = default!;
|
||||||
|
|
||||||
[SupplyParameterFromForm]
|
[SupplyParameterFromForm]
|
||||||
private InputModel Input { get; set; } = null!;
|
private InputModel Input { get; set; } = new();
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
private IEnumerable<IdentityError>? identityErrors;
|
private IEnumerable<IdentityError>? identityErrors;
|
||||||
|
|
||||||
[SupplyParameterFromForm]
|
[SupplyParameterFromForm]
|
||||||
private InputModel Input { get; set; } = null!;
|
private InputModel Input { get; set; } = new();
|
||||||
|
|
||||||
[SupplyParameterFromQuery]
|
[SupplyParameterFromQuery]
|
||||||
private string? ReturnUrl { get; set; }
|
private string? ReturnUrl { get; set; }
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
private string? message;
|
private string? message;
|
||||||
|
|
||||||
[SupplyParameterFromForm]
|
[SupplyParameterFromForm]
|
||||||
private InputModel Input { get; set; } = null!;
|
private InputModel Input { get; set; } = new();
|
||||||
|
|
||||||
private async Task OnValidSubmitAsync()
|
private async Task OnValidSubmitAsync()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
private IEnumerable<IdentityError>? identityErrors;
|
private IEnumerable<IdentityError>? identityErrors;
|
||||||
|
|
||||||
[SupplyParameterFromForm]
|
[SupplyParameterFromForm]
|
||||||
private InputModel Input { get; set; } = null!;
|
private InputModel Input { get; set; } = new();
|
||||||
|
|
||||||
[SupplyParameterFromQuery]
|
[SupplyParameterFromQuery]
|
||||||
private string? Code { get; set; }
|
private string? Code { get; set; }
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
@inherits LayoutComponentBase
|
@inherits LayoutComponentBase
|
||||||
@layout CouchLog.Components.Layout.MainLayout
|
@layout CouchLog.Components.Layout.MainLayout
|
||||||
|
|
||||||
<MudText Typo="Typo.h2">Manage your account</MudText>
|
<h1>Manage your account</h1>
|
||||||
|
|
||||||
<MudContainer MaxWidth="MaxWidth.False" Class="pa-4">
|
<div>
|
||||||
<MudText Typo="Typo.h4">Change your account settings</MudText>
|
<h2>Change your account settings</h2>
|
||||||
<hr/>
|
<hr />
|
||||||
<MudGrid>
|
<div class="row">
|
||||||
<MudItem xs="12" md="3" lg="2">
|
<div class="col-lg-3">
|
||||||
<ManageNavMenu/>
|
<ManageNavMenu />
|
||||||
</MudItem>
|
</div>
|
||||||
|
<div class="col-lg-9">
|
||||||
<MudItem xs="12" md="9" lg="10">
|
|
||||||
@Body
|
@Body
|
||||||
</MudItem>
|
</div>
|
||||||
</MudGrid>
|
</div>
|
||||||
</MudContainer>
|
</div>
|
||||||
@@ -3,41 +3,33 @@
|
|||||||
|
|
||||||
@inject SignInManager<ApplicationUser> SignInManager
|
@inject SignInManager<ApplicationUser> SignInManager
|
||||||
|
|
||||||
<MudNavMenu>
|
<ul class="nav nav-pills flex-column">
|
||||||
<MudNavLink Href="Account/Manage"
|
<li class="nav-item">
|
||||||
Icon="@Icons.Material.Filled.ManageAccounts">
|
<NavLink class="nav-link" href="Account/Manage" Match="NavLinkMatch.All">Profile</NavLink>
|
||||||
Manage
|
</li>
|
||||||
</MudNavLink>
|
|
||||||
<!--
|
<!--
|
||||||
<MudNavLink Href="Account/Manage/Email"
|
<li class="nav-item">
|
||||||
Icon="@Icons.Material.Filled.Email">
|
<NavLink class="nav-link" href="Account/Manage/Email">Email</NavLink>
|
||||||
Email
|
</li>
|
||||||
</MudNavLink>
|
|
||||||
-->
|
-->
|
||||||
<MudNavLink Href="Account/ChangePassword"
|
<li class="nav-item">
|
||||||
Icon="@Icons.Material.Filled.Password">
|
<NavLink class="nav-link" href="Account/Manage/ChangePassword">Password</NavLink>
|
||||||
Password
|
</li>
|
||||||
</MudNavLink>
|
|
||||||
@if (hasExternalLogins)
|
@if (hasExternalLogins)
|
||||||
{
|
{
|
||||||
<MudNavLink Href="Account/Manage/ExternalLogins"
|
<li class="nav-item">
|
||||||
Icon="@Icons.Material.Filled.Login">
|
<NavLink class="nav-link" href="Account/Manage/ExternalLogins">External logins</NavLink>
|
||||||
External logins
|
</li>
|
||||||
</MudNavLink>
|
|
||||||
}
|
}
|
||||||
<!--
|
<!--
|
||||||
<MudNavLink Href="Account/Manage/TwoFactorAuthentication"
|
<li class="nav-item">
|
||||||
Icon="@Icons.Material.Filled.FactCheck">
|
<NavLink class="nav-link" href="Account/Manage/TwoFactorAuthentication">Two-factor authentication</NavLink>
|
||||||
Two-factor authentication
|
</li>
|
||||||
</MudNavLink>
|
|
||||||
-->
|
-->
|
||||||
<!--
|
<li class="nav-item">
|
||||||
<MudNavLink Href="Account/Manage/PersonalData"
|
<NavLink class="nav-link" href="Account/Manage/PersonalData">Personal data</NavLink>
|
||||||
Icon="@Icons.Material.Filled.DataObject">
|
</li>
|
||||||
Personal data
|
</ul>
|
||||||
</MudNavLink>
|
|
||||||
-->
|
|
||||||
</MudNavMenu>
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private bool hasExternalLogins;
|
private bool hasExternalLogins;
|
||||||
|
|||||||
@@ -17,11 +17,11 @@
|
|||||||
Color="Color.Primary" />
|
Color="Color.Primary" />
|
||||||
</EditForm>
|
</EditForm>
|
||||||
|
|
||||||
@*<MudText>Version: @_version</MudText>*@
|
<MudText>Version: @_version</MudText>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private AccountsSettings _accountsSettings = null!;
|
private AccountsSettings? _accountsSettings;
|
||||||
//private readonly string _version = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion?.Split('+')[0];
|
private readonly string _version = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion?.Split('+')[0];
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,16 +1,11 @@
|
|||||||
@using CouchLog.Data
|
@using CouchLog.Data
|
||||||
|
|
||||||
<MudCard>
|
<MudCard>
|
||||||
<MudPaper Elevation="0" Style="position: relative;" @onmouseenter="@(() => _showEditOverlay = true)" @onmouseleave="@(() => _showEditOverlay = false)">
|
<MudPaper Elevation="0">
|
||||||
<MudCardMedia Image="@($"{GlobalEntity.PicturePath}?v={DateTime.Now.Ticks}")" Height="400" Style="object-fit: contain;"/>
|
<MudCardMedia Image="@GlobalEntity.PicturePath" Height="400" Style="object-fit: contain;"/>
|
||||||
<MudOverlay Visible="@_showEditOverlay" DarkBackground="true" Absolute="true">
|
|
||||||
<MudIconButton Icon="@Icons.Material.Rounded.Edit" Color="Color.Primary" OnClick="@(()=> OnEdit.InvokeAsync(GlobalEntity))" />
|
|
||||||
</MudOverlay>
|
|
||||||
</MudPaper>
|
</MudPaper>
|
||||||
<MudCardContent>
|
<MudCardContent>
|
||||||
<MudTooltip Text="@GlobalEntity.Title">
|
<MudText Typo="Typo.h5">@GlobalEntity.Title</MudText>
|
||||||
<MudText Typo="Typo.h5" Style="display: block; max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">@GlobalEntity.Title</MudText>
|
|
||||||
</MudTooltip>
|
|
||||||
</MudCardContent>
|
</MudCardContent>
|
||||||
<MudCardActions>
|
<MudCardActions>
|
||||||
<MudTooltip Text="Add to shared List">
|
<MudTooltip Text="Add to shared List">
|
||||||
@@ -39,7 +34,4 @@
|
|||||||
|
|
||||||
[Parameter] public EventCallback<GlobalEntity> OnAddToPrivate { get; set; }
|
[Parameter] public EventCallback<GlobalEntity> OnAddToPrivate { get; set; }
|
||||||
[Parameter] public EventCallback<GlobalEntity> OnAddToShared { get; set; }
|
[Parameter] public EventCallback<GlobalEntity> OnAddToShared { get; set; }
|
||||||
[Parameter] public EventCallback<GlobalEntity> OnEdit { get; set; }
|
|
||||||
|
|
||||||
private bool _showEditOverlay;
|
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
@using CouchLog.Data
|
@using CouchLog.Data
|
||||||
@using Microsoft.EntityFrameworkCore
|
@using Microsoft.EntityFrameworkCore
|
||||||
|
@using Microsoft.AspNetCore.Authorization
|
||||||
@using Microsoft.AspNetCore.Identity
|
@using Microsoft.AspNetCore.Identity
|
||||||
@using System.ComponentModel.DataAnnotations
|
@using System.ComponentModel.DataAnnotations
|
||||||
|
|
||||||
@inject ApplicationDbContext CouchLogDb
|
@inject ApplicationDbContext CouchLogDB
|
||||||
@inject UserManager<ApplicationUser> UserManager
|
@inject UserManager<ApplicationUser> UserManager
|
||||||
@inject AuthenticationStateProvider AuthenticationStateProvider
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@@ -22,10 +23,10 @@
|
|||||||
</TitleContent>
|
</TitleContent>
|
||||||
|
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<EditForm EditContext="_editContext" OnSubmit="HandleSubmit" id="New-Global-Entity-Form">
|
<EditForm EditContext="_editContext" OnSubmit="HandleSubmit">
|
||||||
<DataAnnotationsValidator />
|
<DataAnnotationsValidator />
|
||||||
|
|
||||||
<MudStack Row="true" Spacing="3" AlignItems="AlignItems.Start" Style="min-height: 400px;" Breakpoint="Breakpoint.SmAndDown">
|
<MudStack Row="true" Spacing="3" AlignItems="AlignItems.Start" Style="min-height: 400px;">
|
||||||
<!--<editor-fold desc="Picture-Upload">-->
|
<!--<editor-fold desc="Picture-Upload">-->
|
||||||
<MudPaper Class="pa-0" Elevation="0" Width="280px" MinWidth="280px">
|
<MudPaper Class="pa-0" Elevation="0" Width="280px" MinWidth="280px">
|
||||||
@if (!string.IsNullOrWhiteSpace(_imagePreview))
|
@if (!string.IsNullOrWhiteSpace(_imagePreview))
|
||||||
@@ -43,12 +44,13 @@
|
|||||||
Accept="image/*"
|
Accept="image/*"
|
||||||
InputClass="null"
|
InputClass="null"
|
||||||
Class="mud-file-upload-dragarea">
|
Class="mud-file-upload-dragarea">
|
||||||
<SelectedTemplate Context="selectedTemplateContext"/>
|
<SelectedTemplate Context="SelectedTemplateContext"/>
|
||||||
</MudFileUpload>
|
</MudFileUpload>
|
||||||
}
|
}
|
||||||
</MudPaper>
|
</MudPaper>
|
||||||
<!--</editor-fold>-->
|
<!--</editor-fold>-->
|
||||||
<MudPaper Class="flex-grow-1" Elevation="0" MinWidth="200px">
|
|
||||||
|
<MudPaper Class="flex-grow-1" Elevation="0">
|
||||||
<MudStack Spacing="3">
|
<MudStack Spacing="3">
|
||||||
|
|
||||||
<MudTextField @bind-Value="_form.Title"
|
<MudTextField @bind-Value="_form.Title"
|
||||||
@@ -77,6 +79,17 @@
|
|||||||
}
|
}
|
||||||
</MudSelect>
|
</MudSelect>
|
||||||
<MudCheckBox @bind-Value="_isPrivate" Label="Is Private" Color="Color.Primary" />
|
<MudCheckBox @bind-Value="_isPrivate" Label="Is Private" Color="Color.Primary" />
|
||||||
|
<MudButton ButtonType="ButtonType.Submit" Variant="Variant.Filled" Color="Color.Success" Disabled="_isSaving" Class="mt-3">
|
||||||
|
@if (_isSaving)
|
||||||
|
{
|
||||||
|
<MudProgressCircular Indeterminate="true" Size="Size.Small" Class="mr-2" />
|
||||||
|
<span>Saving...</span>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<span>Create Global Entity</span>
|
||||||
|
}
|
||||||
|
</MudButton>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
</MudPaper>
|
</MudPaper>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
@@ -84,18 +97,7 @@
|
|||||||
</DialogContent>
|
</DialogContent>
|
||||||
|
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<MudButton OnClick="Cancel" Variant="Variant.Filled" Color="Color.Error" Disabled="_isSaving" Class="mt-3">Cancel</MudButton>
|
<MudButton OnClick="Cancel" Variant="Variant.Text" Disabled="_isSaving">Cancel</MudButton>
|
||||||
<MudButton ButtonType="ButtonType.Submit" Variant="Variant.Filled" Color="Color.Success" Disabled="_isSaving" Class="mt-3" form="New-Global-Entity-Form">
|
|
||||||
@if (_isSaving)
|
|
||||||
{
|
|
||||||
<MudProgressCircular Indeterminate="true" Size="Size.Small" Class="mr-2"/>
|
|
||||||
<span>Saving...</span>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<span>Create Global Entity</span>
|
|
||||||
}
|
|
||||||
</MudButton>
|
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</MudDialog>
|
</MudDialog>
|
||||||
|
|
||||||
@@ -118,9 +120,6 @@
|
|||||||
|
|
||||||
//Picture
|
//Picture
|
||||||
private IBrowserFile? _pictureFile;
|
private IBrowserFile? _pictureFile;
|
||||||
private string _pictureBase64 = null!;
|
|
||||||
private string? _pictureContentType;
|
|
||||||
private string? _pictureExtension;
|
|
||||||
|
|
||||||
private class GlobalEntityFormModel
|
private class GlobalEntityFormModel
|
||||||
{
|
{
|
||||||
@@ -143,8 +142,8 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_mediaTypes = await CouchLogDb.MediaType.OrderBy(t => t.Id).ToListAsync();
|
_mediaTypes = await CouchLogDB.MediaType.OrderBy(t => t.Id).ToListAsync();
|
||||||
_genres = await CouchLogDb.Genres.OrderBy(t => t.Id).ToListAsync();
|
_genres = await CouchLogDB.Genres.OrderBy(t => t.Id).ToListAsync();
|
||||||
|
|
||||||
if (_mediaTypes.Count > 0)
|
if (_mediaTypes.Count > 0)
|
||||||
_selectedMediaTypeId = _mediaTypes.First().Id;
|
_selectedMediaTypeId = _mediaTypes.First().Id;
|
||||||
@@ -166,11 +165,8 @@
|
|||||||
using var ms = new MemoryStream();
|
using var ms = new MemoryStream();
|
||||||
await stream.CopyToAsync(ms);
|
await stream.CopyToAsync(ms);
|
||||||
|
|
||||||
_pictureContentType = _pictureFile.ContentType;
|
var base64 = Convert.ToBase64String(ms.ToArray());
|
||||||
_pictureExtension = Path.GetExtension(_pictureFile.Name);
|
_imagePreview = $"data:{_pictureFile.ContentType};base64,{base64}";
|
||||||
|
|
||||||
_pictureBase64 = Convert.ToBase64String(ms.ToArray());
|
|
||||||
_imagePreview = $"data:{_pictureFile.ContentType};base64,{_pictureBase64}";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Cancel() => MudDialog.Cancel();
|
private void Cancel() => MudDialog.Cancel();
|
||||||
@@ -195,10 +191,13 @@
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string fileName = $"{Guid.NewGuid()}{_pictureExtension}";
|
string fileName = $"{Guid.NewGuid()}{Path.GetExtension(_pictureFile.Name)}";
|
||||||
string picturePath = Path.Combine("wwwroot", "Pictures", fileName);
|
string picturePath = Path.Combine("wwwroot", "Pictures", fileName);
|
||||||
|
|
||||||
await File.WriteAllBytesAsync(picturePath, Convert.FromBase64String(_pictureBase64));
|
await using (var fs = File.Create(picturePath))
|
||||||
|
{
|
||||||
|
await _pictureFile.OpenReadStream(maxAllowedSize: 10_000_000).CopyToAsync(fs);
|
||||||
|
}
|
||||||
|
|
||||||
var entity = new GlobalEntity
|
var entity = new GlobalEntity
|
||||||
{
|
{
|
||||||
@@ -210,19 +209,19 @@
|
|||||||
IsPrivate = _isPrivate
|
IsPrivate = _isPrivate
|
||||||
};
|
};
|
||||||
|
|
||||||
CouchLogDb.Add(entity);
|
CouchLogDB.Add(entity);
|
||||||
await CouchLogDb.SaveChangesAsync();
|
await CouchLogDB.SaveChangesAsync();
|
||||||
|
|
||||||
foreach (int genreId in _selectedGenreIds)
|
foreach (int genreId in _selectedGenreIds)
|
||||||
{
|
{
|
||||||
CouchLogDb.Add(new LinkTableGlobalGenre
|
CouchLogDB.Add(new LinkTableGlobalGenre
|
||||||
{
|
{
|
||||||
GenreId = genreId,
|
GenreId = genreId,
|
||||||
GlobalEntityId = entity.Id
|
GlobalEntityId = entity.Id
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
await CouchLogDb.SaveChangesAsync();
|
await CouchLogDB.SaveChangesAsync();
|
||||||
|
|
||||||
Snackbar.Add("Global Entity created!", Severity.Success);
|
Snackbar.Add("Global Entity created!", Severity.Success);
|
||||||
MudDialog.Close(DialogResult.Ok(entity));
|
MudDialog.Close(DialogResult.Ok(entity));
|
||||||
|
|||||||
@@ -1,340 +0,0 @@
|
|||||||
@using CouchLog.Data
|
|
||||||
@using Microsoft.EntityFrameworkCore
|
|
||||||
|
|
||||||
@inject ApplicationDbContext CouchLogDb
|
|
||||||
@inject ISnackbar Snackbar
|
|
||||||
|
|
||||||
<MudDialog>
|
|
||||||
<TitleContent>
|
|
||||||
<MudText Typo="Typo.h6">Edit Global Entity</MudText>
|
|
||||||
</TitleContent>
|
|
||||||
|
|
||||||
<DialogContent>
|
|
||||||
<MudStack Row="true" Spacing="3" AlignItems="AlignItems.Start" Style="min-height: 400px;" Breakpoint="Breakpoint.SmAndDown">
|
|
||||||
<!--<editor-fold desc="Picture-Upload">-->
|
|
||||||
@if (!string.IsNullOrWhiteSpace(_imagePreview))
|
|
||||||
{
|
|
||||||
<MudPaper Class="pa-0" Elevation="0" Width="280px" MinWidth="280px" Style="position: relative" @onmouseenter="@(() => _showChangePictureOverlay = true)" @onmouseleave="@(() => _showChangePictureOverlay = false)">
|
|
||||||
<MudImage Src="@_imagePreview"
|
|
||||||
ObjectFit="ObjectFit.Contain"
|
|
||||||
Class="rounded"
|
|
||||||
Style="width: 280px; height: 400px;"/>
|
|
||||||
<MudOverlay Visible="@_showChangePictureOverlay" DarkBackground="true" Absolute="true">
|
|
||||||
<MudIconButton Icon="@Icons.Material.Rounded.Edit" Color="Color.Primary" OnClick="@(() => PrepareForNewImage())"/>
|
|
||||||
</MudOverlay>
|
|
||||||
</MudPaper>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<MudPaper Class="pa-0" Elevation="0" Width="280px" MinWidth="280px" Style="position: relative">
|
|
||||||
<MudFileUpload @bind-Files="_pictureFile"
|
|
||||||
DragAndDrop="true"
|
|
||||||
OnFilesChanged="OnPictureUploaded"
|
|
||||||
Accept="image/*"
|
|
||||||
InputClass="null"
|
|
||||||
Class="mud-file-upload-dragarea">
|
|
||||||
<SelectedTemplate Context="selectedTemplateContext"/>
|
|
||||||
</MudFileUpload>
|
|
||||||
</MudPaper>
|
|
||||||
}
|
|
||||||
<!--</editor-fold>-->
|
|
||||||
<MudPaper Class="flex-grow-1" Elevation="0" MinWidth="200px">
|
|
||||||
<MudStack Spacing="3">
|
|
||||||
<MudTextField @bind-Value="_editedGlobalEntity.Title"
|
|
||||||
Label="Title"
|
|
||||||
Variant="Variant.Outlined" />
|
|
||||||
<MudSelect T="int"
|
|
||||||
@bind-Value="_editedGlobalEntity.TypeId"
|
|
||||||
Label="Type"
|
|
||||||
Variant="Variant.Outlined">
|
|
||||||
@foreach (var type in _mediaTypes)
|
|
||||||
{
|
|
||||||
<MudSelectItem T="int" Value="@type.Id">@type.Name</MudSelectItem>
|
|
||||||
}
|
|
||||||
</MudSelect>
|
|
||||||
|
|
||||||
<MudSelect T="int"
|
|
||||||
Label="Genres"
|
|
||||||
MultiSelection="true"
|
|
||||||
@bind-SelectedValues="_selectedGenreIds"
|
|
||||||
Variant="Variant.Outlined">
|
|
||||||
@foreach (var genre in _genres)
|
|
||||||
{
|
|
||||||
<MudSelectItem T="int" Value="@genre.Id">@genre.Name</MudSelectItem>
|
|
||||||
}
|
|
||||||
</MudSelect>
|
|
||||||
<MudCheckBox @bind-Value="_isPrivate" Label="Is Private" Color="Color.Primary" />
|
|
||||||
@if (AppUser.Id == _editedGlobalEntity.CreatorId)
|
|
||||||
{
|
|
||||||
<MudButton OnClick="HandleDelete"
|
|
||||||
StartIcon="@Icons.Material.Filled.Delete"
|
|
||||||
Variant="Variant.Filled"
|
|
||||||
Color="Color.Error">
|
|
||||||
Delete
|
|
||||||
</MudButton>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<AuthorizeView Roles="Admin">
|
|
||||||
<Authorized>
|
|
||||||
<MudButton OnClick="HandleDelete"
|
|
||||||
StartIcon="@Icons.Material.Filled.Delete"
|
|
||||||
Variant="Variant.Filled"
|
|
||||||
Color="Color.Error">
|
|
||||||
Delete
|
|
||||||
</MudButton>
|
|
||||||
</Authorized>
|
|
||||||
</AuthorizeView>
|
|
||||||
}
|
|
||||||
</MudStack>
|
|
||||||
</MudPaper>
|
|
||||||
</MudStack>
|
|
||||||
</DialogContent>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<DialogActions>
|
|
||||||
<MudButton OnClick="Cancel" Variant="Variant.Filled" Color="Color.Error">Cancel</MudButton>
|
|
||||||
<MudButton OnClick="SaveChanges" Variant="Variant.Filled" Color="Color.Success">Save Changes</MudButton>
|
|
||||||
</DialogActions>
|
|
||||||
</MudDialog>
|
|
||||||
|
|
||||||
@code
|
|
||||||
{
|
|
||||||
[CascadingParameter] private IMudDialogInstance Dialog { get; set; } = null!;
|
|
||||||
|
|
||||||
[Parameter] public GlobalEntity GlobalEntity { get; set; } = null!;
|
|
||||||
[Parameter] public ApplicationUser AppUser { get; set; } = null!;
|
|
||||||
|
|
||||||
[Inject] private IDialogService DialogService { get; set; }
|
|
||||||
|
|
||||||
private GlobalEntity _editedGlobalEntity = null!;
|
|
||||||
private string? _imagePreview;
|
|
||||||
private IBrowserFile? _pictureFile;
|
|
||||||
private List<MediaType> _mediaTypes = new();
|
|
||||||
private IReadOnlyCollection<int> _selectedGenreIds = Array.Empty<int>();
|
|
||||||
private List<Genre> _genres = new();
|
|
||||||
private bool _isPrivate;
|
|
||||||
|
|
||||||
private bool _showChangePictureOverlay;
|
|
||||||
|
|
||||||
private string _oldImageBase64;
|
|
||||||
|
|
||||||
private string _placeHolder = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAB9AAAAprBAMAAAB5zFs8AAAAJ1BMVEX5+vz4+frN2OTS3efz9fjv8/bd5OzP2uXi6O/X4Onp7vP29/nl6/FTF5aSAAAAAXRSTlOfIFZWswAAN+9JREFUeNrs04EAAAAIwLAU8pfNo28OmwXeEx0CRIcA0SFAdAgQHQJEhwDRIUB0CBAdAkSHANEhQHQIEB0CRIcA0SFAdAgQHQJEhwDRIUB0CBAdAkSHANEhQHQIEB0CRIcA0SFAdAgQHQJEhwDRIUB0CBAdAkSHANEhQHQIEB0CRI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2ZBn8yxQiShR1u4WZmAF1xCCT3alYqH9xkg9FDzHtwndL8QR+ihnLg7eZ8VQo/0pTKprpfT4wg91JyrMv/heSGK0ENdqDiPmw1CjzPnU5Buws4KoUcZOdA377y/mnCAXVz5uWakT4HQw4wa6DtvSl6d3W0jvTWhhxk+0E/dKLktvOsZ6W0JPcrQgb7k34hK6Tw00psSepRhA33DJ9L2XFs30hsSepiFgZvoWbdC9n3r1QFeFyIIPcyhOsCLwh/zg0rvFiIIPcyWzseY77nx3orQoyz6COIYg0s/Wggg9Cjna58N+/kBh2ufIw4rf7N390hOw3AYxs8g/LFxQoOACTvQkBkqulDRpqHGNyBDR5cb4BuQhgNQMJSk4Vq0RvFsbOl9qZ7fGfaJLekvrwOhW0yerd2zo3zlfbzyNkCP0E3amNr+Drjyh+24/4LQTS5cwpxh8s2HH0QDQveoY+Line truncated
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
|
||||||
await CouchLogDb.GlobalEntities
|
|
||||||
.Include(x => x.MediaType)
|
|
||||||
.Include(x => x.LinkTableGlobalGenres)
|
|
||||||
.LoadAsync();
|
|
||||||
|
|
||||||
_editedGlobalEntity = new GlobalEntity
|
|
||||||
{
|
|
||||||
//Required
|
|
||||||
Id = GlobalEntity.Id,
|
|
||||||
CreatorId = GlobalEntity.CreatorId,
|
|
||||||
CreationTime = GlobalEntity.CreationTime,
|
|
||||||
TypeId = GlobalEntity.TypeId,
|
|
||||||
|
|
||||||
//Editable
|
|
||||||
Title = GlobalEntity.Title,
|
|
||||||
MediaType = GlobalEntity.MediaType,
|
|
||||||
LinkTableGlobalGenres = GlobalEntity.LinkTableGlobalGenres,
|
|
||||||
IsPrivate = GlobalEntity.IsPrivate,
|
|
||||||
PicturePath = GlobalEntity.PicturePath,
|
|
||||||
};
|
|
||||||
await GetImagePreview();
|
|
||||||
_mediaTypes = await CouchLogDb.MediaType.OrderBy(t => t.Id).ToListAsync();
|
|
||||||
_selectedGenreIds = GlobalEntity.LinkTableGlobalGenres.Select(x => x.GenreId).ToList();
|
|
||||||
//var newGenreIds = new HashSet<int>(_selectedGenreIds);
|
|
||||||
_genres = await CouchLogDb.Genres.OrderBy(t => t.Id).ToListAsync();
|
|
||||||
_isPrivate = _editedGlobalEntity.IsPrivate;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task GetImagePreview()
|
|
||||||
{
|
|
||||||
if (_editedGlobalEntity.PicturePath == null)
|
|
||||||
{
|
|
||||||
_imagePreview = _placeHolder;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
string path = Path.Combine("wwwroot", _editedGlobalEntity.PicturePath);
|
|
||||||
|
|
||||||
byte[] imageArray;
|
|
||||||
string base64Image = "";
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
imageArray = await File.ReadAllBytesAsync(path);
|
|
||||||
base64Image = Convert.ToBase64String(imageArray);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!String.IsNullOrWhiteSpace(base64Image))
|
|
||||||
{
|
|
||||||
_imagePreview = $"data:image/jpeg;base64,{base64Image}";
|
|
||||||
_oldImageBase64 = _imagePreview;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_imagePreview = _placeHolder;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task PrepareForNewImage()
|
|
||||||
{
|
|
||||||
if (_imagePreview != _placeHolder)
|
|
||||||
{
|
|
||||||
_imagePreview = null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_imagePreview = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task OnPictureUploaded()
|
|
||||||
{
|
|
||||||
if (_pictureFile == null)
|
|
||||||
{
|
|
||||||
Snackbar.Add("No file selected!", Severity.Warning);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_pictureFile.Size > 5242880)
|
|
||||||
{
|
|
||||||
Snackbar.Add("File size exceeds 5MB!", Severity.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await using var stream = _pictureFile.OpenReadStream(5242880);
|
|
||||||
using var ms = new MemoryStream();
|
|
||||||
await stream.CopyToAsync(ms);
|
|
||||||
|
|
||||||
var _pictureContentType = _pictureFile.ContentType;
|
|
||||||
var _pictureExtension = Path.GetExtension(_pictureFile.Name);
|
|
||||||
|
|
||||||
var _pictureBase64 = Convert.ToBase64String(ms.ToArray());
|
|
||||||
_imagePreview = $"data:{_pictureFile.ContentType};base64,{_pictureBase64}";
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task HandleDelete()
|
|
||||||
{
|
|
||||||
//TODO: Add Message Box
|
|
||||||
File.Delete(Path.Combine("wwwroot", GlobalEntity.PicturePath));
|
|
||||||
Dialog.Close(DialogResult.Ok((GlobalEntity, true)));
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool CheckForChanges()
|
|
||||||
{
|
|
||||||
if (_editedGlobalEntity.Title != GlobalEntity.Title)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if(_editedGlobalEntity.TypeId != GlobalEntity.TypeId)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var newGenresHashSet = new HashSet<int>(_selectedGenreIds);
|
|
||||||
var oldGenereIds = GlobalEntity.LinkTableGlobalGenres.Select(g => g.GenreId);
|
|
||||||
if (!newGenresHashSet.SetEquals(oldGenereIds))
|
|
||||||
{
|
|
||||||
//Snackbar.Add("Selected genre id is", Severity.Warning);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_editedGlobalEntity.IsPrivate != GlobalEntity.IsPrivate)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_imagePreview != _oldImageBase64)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateGenreLinks()
|
|
||||||
{
|
|
||||||
var currentGenreIds = GlobalEntity.LinkTableGlobalGenres.Select(g => g.GenreId).ToHashSet();
|
|
||||||
var selectedGenreIds = _selectedGenreIds.ToHashSet();
|
|
||||||
|
|
||||||
var toRemove = GlobalEntity.LinkTableGlobalGenres
|
|
||||||
.Where(g => !selectedGenreIds.Contains(g.GenreId))
|
|
||||||
.ToList();
|
|
||||||
foreach (var link in toRemove)
|
|
||||||
{
|
|
||||||
GlobalEntity.LinkTableGlobalGenres.Remove(link);
|
|
||||||
}
|
|
||||||
|
|
||||||
var toAdd = selectedGenreIds.Where(id => !currentGenreIds.Contains(id));
|
|
||||||
foreach (var genreId in toAdd)
|
|
||||||
{
|
|
||||||
GlobalEntity.LinkTableGlobalGenres.Add(new LinkTableGlobalGenre
|
|
||||||
{
|
|
||||||
GlobalEntityId = GlobalEntity.Id,
|
|
||||||
GenreId = genreId
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task SaveImageToFile(string dataUrl, string targetPath)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(dataUrl))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var commaIndex = dataUrl.IndexOf(',');
|
|
||||||
if (commaIndex < 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
string base64Data = dataUrl.Substring(commaIndex + 1);
|
|
||||||
byte[] imageBytes = Convert.FromBase64String(base64Data);
|
|
||||||
|
|
||||||
await File.WriteAllBytesAsync(targetPath, imageBytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task SaveChanges()
|
|
||||||
{
|
|
||||||
if (CheckForChanges())
|
|
||||||
{
|
|
||||||
bool? result = await DialogService.ShowMessageBoxAsync(
|
|
||||||
"Warning",
|
|
||||||
"Do you really want to save does changes?",
|
|
||||||
yesText:"Save", cancelText:"Cancel");
|
|
||||||
|
|
||||||
if (result == true)
|
|
||||||
{
|
|
||||||
GlobalEntity.Title = _editedGlobalEntity.Title;
|
|
||||||
GlobalEntity.TypeId = _editedGlobalEntity.TypeId;
|
|
||||||
GlobalEntity.MediaType = _editedGlobalEntity.MediaType;
|
|
||||||
UpdateGenreLinks();
|
|
||||||
GlobalEntity.IsPrivate = _editedGlobalEntity.IsPrivate;
|
|
||||||
GlobalEntity.LastChange = DateTime.UtcNow;
|
|
||||||
|
|
||||||
SaveImageToFile(_imagePreview, Path.Combine("wwwroot", _editedGlobalEntity.PicturePath));
|
|
||||||
|
|
||||||
await CouchLogDb.SaveChangesAsync();
|
|
||||||
Dialog.Close(DialogResult.Ok((GlobalEntity, false)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Snackbar.Add("You changed nothing so there is nothing to save!", Severity.Info);
|
|
||||||
Cancel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Cancel()
|
|
||||||
{
|
|
||||||
Dialog.Cancel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -78,12 +78,11 @@
|
|||||||
<MudGrid Spacing="6" Justify="Justify.Center">
|
<MudGrid Spacing="6" Justify="Justify.Center">
|
||||||
@foreach (var globalEntity in VisibleGlobalEntities)
|
@foreach (var globalEntity in VisibleGlobalEntities)
|
||||||
{
|
{
|
||||||
<MudItem xs="12" sm="6" md="4" lg="3" xl="2" Style="min-width: 0;">
|
<MudItem xs="12" sm="6" md="4" lg="3" xl="2">
|
||||||
<GlobalEntityCard GlobalEntity="globalEntity"
|
<GlobalEntityCard GlobalEntity="globalEntity"
|
||||||
UserPrivateEntityIds="_userPrivateEntityIds"
|
UserPrivateEntityIds="_userPrivateEntityIds"
|
||||||
OnAddToPrivate="AddGlobalEntityToPrivateList"
|
OnAddToPrivate="AddGlobalEntityToPrivateList"
|
||||||
OnAddToShared="AddGlobalEntityToSharedList"
|
OnAddToShared="AddGlobalEntityToSharedList"/>
|
||||||
OnEdit="OpenEditGlobalEntityDialog"/>
|
|
||||||
</MudItem>
|
</MudItem>
|
||||||
}
|
}
|
||||||
</MudGrid>
|
</MudGrid>
|
||||||
@@ -152,7 +151,7 @@
|
|||||||
|
|
||||||
private async Task OnNewEntity(GlobalEntity entity)
|
private async Task OnNewEntity(GlobalEntity entity)
|
||||||
{
|
{
|
||||||
_globalEntities.Insert(0, entity);
|
_globalEntities.Add(entity);
|
||||||
await RefreshPage();
|
await RefreshPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,44 +166,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OpenEditGlobalEntityDialog(GlobalEntity globalEntity)
|
|
||||||
{
|
|
||||||
var parameters = new DialogParameters<EditGlobalEntityDialog>
|
|
||||||
{
|
|
||||||
{ x => x.GlobalEntity, globalEntity },
|
|
||||||
{ x => x.AppUser, _appUser}
|
|
||||||
};
|
|
||||||
|
|
||||||
var dialog = await DialogService.ShowAsync<EditGlobalEntityDialog>("Edit Global Entity", parameters);
|
|
||||||
var result = await dialog.Result;
|
|
||||||
|
|
||||||
if (!result!.Canceled && result.Data is ValueTuple<GlobalEntity, bool> data)
|
|
||||||
{
|
|
||||||
if (data.Item2)
|
|
||||||
{
|
|
||||||
CouchLogDb.GlobalEntities.Remove(data.Item1);
|
|
||||||
await CouchLogDb.SaveChangesAsync();
|
|
||||||
|
|
||||||
_globalEntities.RemoveAll(x => x.Id == data.Item1.Id);
|
|
||||||
|
|
||||||
if (_currentPage > TotalPages)
|
|
||||||
_currentPage = Math.Max(1, TotalPages);
|
|
||||||
|
|
||||||
StateHasChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!data.Item2)
|
|
||||||
{
|
|
||||||
int index = _globalEntities.FindIndex(x => x.Id == data.Item1.Id);
|
|
||||||
if (index >= 0)
|
|
||||||
{
|
|
||||||
_globalEntities[index] = data.Item1;
|
|
||||||
}
|
|
||||||
StateHasChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task AddGlobalEntityToPrivateList(GlobalEntity globalEntity)
|
public async Task AddGlobalEntityToPrivateList(GlobalEntity globalEntity)
|
||||||
{
|
{
|
||||||
if(_appUser is null) { Snackbar.Add("Not logged in!", Severity.Error); return;}
|
if(_appUser is null) { Snackbar.Add("Not logged in!", Severity.Error); return;}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<!--<editor-fold desc="Poster-Image">-->
|
<!--<editor-fold desc="Poster-Image">-->
|
||||||
<MudItem xs="4">
|
<MudItem xs="4">
|
||||||
<MudImage
|
<MudImage
|
||||||
Src="@($"{PrivateEntity.GlobalEntity.PicturePath}?v={DateTime.Now.Ticks}")"
|
Src="@PrivateEntity.GlobalEntity.PicturePath"
|
||||||
Alt=""
|
Alt=""
|
||||||
ObjectFit="ObjectFit.Cover"
|
ObjectFit="ObjectFit.Cover"
|
||||||
Style="width: 100%; height: 100%; min-height: 180px; border-radius: 4px 0 0 4px;" />
|
Style="width: 100%; height: 100%; min-height: 180px; border-radius: 4px 0 0 4px;" />
|
||||||
@@ -17,9 +17,7 @@
|
|||||||
<MudStack Class="pa-3" Spacing="2">
|
<MudStack Class="pa-3" Spacing="2">
|
||||||
<!--<editor-fold desc="Options">-->
|
<!--<editor-fold desc="Options">-->
|
||||||
<MudStack Row="true" AlignItems="AlignItems.Center" Justify="Justify.SpaceBetween">
|
<MudStack Row="true" AlignItems="AlignItems.Center" Justify="Justify.SpaceBetween">
|
||||||
<MudTooltip Text="@PrivateEntity.GlobalEntity.Title">
|
<MudText Typo="Typo.h6">@PrivateEntity.GlobalEntity.Title</MudText>
|
||||||
<MudText Typo="Typo.h6" Style="display: block; max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">@PrivateEntity.GlobalEntity.Title</MudText>
|
|
||||||
</MudTooltip>
|
|
||||||
<MudMenu Icon="@Icons.Material.Filled.MoreVert" Color="Color.Default" Dense="true">
|
<MudMenu Icon="@Icons.Material.Filled.MoreVert" Color="Color.Default" Dense="true">
|
||||||
<MudMenuItem>Edit</MudMenuItem>
|
<MudMenuItem>Edit</MudMenuItem>
|
||||||
<MudMenuItem OnClick="@(() => OnRemove.InvokeAsync())">Remove</MudMenuItem>
|
<MudMenuItem OnClick="@(() => OnRemove.InvokeAsync())">Remove</MudMenuItem>
|
||||||
@@ -42,50 +40,45 @@
|
|||||||
</MudSelect>
|
</MudSelect>
|
||||||
<!--</editor-fold>-->
|
<!--</editor-fold>-->
|
||||||
|
|
||||||
<!-- @if (PrivateEntity.GlobalEntity.MediaType.Name == "Series" || PrivateEntity.GlobalEntity.MediaType.Name == "Anime") -->
|
<!--<editor-fold desc="Dropdown-Season">-->
|
||||||
<!--{-->
|
<MudSelect
|
||||||
<!--<editor-fold desc="Dropdown-Season">-->
|
T="int?"
|
||||||
<MudSelect
|
Value="PrivateEntity.Season"
|
||||||
T="int?"
|
ValueChanged="@(newSeason => OnSeasonChange.InvokeAsync(newSeason))"
|
||||||
Value="PrivateEntity.Season"
|
Dense="true"
|
||||||
ValueChanged="@(newSeason => OnSeasonChange.InvokeAsync(newSeason))"
|
Variant="Variant.Outlined"
|
||||||
Dense="true"
|
Label="">
|
||||||
Variant="Variant.Outlined"
|
@{
|
||||||
Label=""
|
int? currentSeason = PrivateEntity.Season ?? 1;
|
||||||
Class="@(PrivateEntity.GlobalEntity.MediaType.Name == "Series" ? "" : "invisible")">
|
int? startOffsetSeason = currentSeason > 1 ? -1 : 0;
|
||||||
@{
|
}
|
||||||
int? currentSeason = PrivateEntity.Season ?? 1;
|
@for (int? i = startOffsetSeason; i <= 5; i++)
|
||||||
int? startOffsetSeason = currentSeason > 1 ? -1 : 0;
|
{
|
||||||
}
|
int? season = currentSeason + i;
|
||||||
@for (int? i = startOffsetSeason; i <= 5; i++)
|
<MudSelectItem Value="@season">Staffel @season</MudSelectItem>
|
||||||
{
|
}
|
||||||
int? season = currentSeason + i;
|
</MudSelect>
|
||||||
<MudSelectItem Value="@season">Staffel @season</MudSelectItem>
|
<!--</editor-fold>-->
|
||||||
}
|
|
||||||
</MudSelect>
|
|
||||||
<!--</editor-fold>-->
|
|
||||||
|
|
||||||
<!--<editor-fold desc="Dropdown-Episode">-->
|
<!--<editor-fold desc="Dropdown-Episode">-->
|
||||||
<MudSelect
|
<MudSelect
|
||||||
T="int?"
|
T="int?"
|
||||||
Value="PrivateEntity.Episode"
|
Value="PrivateEntity.Episode"
|
||||||
ValueChanged="@(newEpisode => OnEpisodeChange.InvokeAsync(newEpisode))"
|
ValueChanged="@(newEpisode => OnEpisodeChange.InvokeAsync(newEpisode))"
|
||||||
Dense="true"
|
Dense="true"
|
||||||
Variant="Variant.Outlined"
|
Variant="Variant.Outlined"
|
||||||
Label=""
|
Label="">
|
||||||
Class="@(PrivateEntity.GlobalEntity.MediaType.Name == "Series" ? "" : "invisible")">
|
@{
|
||||||
@{
|
int? currentEpisode = PrivateEntity.Episode ?? 1;
|
||||||
int? currentEpisode = PrivateEntity.Episode ?? 1;
|
int? startOffsetEpisode = currentEpisode > 1 ? -1 : 0;
|
||||||
int? startOffsetEpisode = currentEpisode > 1 ? -1 : 0;
|
}
|
||||||
}
|
@for (int? i = startOffsetEpisode; i <= 5; i++)
|
||||||
@for (int? i = startOffsetEpisode; i <= 5; i++)
|
{
|
||||||
{
|
int? episode = currentEpisode + i;
|
||||||
int? episode = currentEpisode + i;
|
<MudSelectItem Value="@episode">Episode @episode</MudSelectItem>
|
||||||
<MudSelectItem Value="@episode">Episode @episode</MudSelectItem>
|
}
|
||||||
}
|
</MudSelect>
|
||||||
</MudSelect>
|
<!--</editor-fold>-->
|
||||||
<!--</editor-fold>-->
|
|
||||||
<!--}-->
|
|
||||||
|
|
||||||
<!--<editor-fold desc="Details Button">-->
|
<!--<editor-fold desc="Details Button">-->
|
||||||
<MudStack Row="true" Justify="Justify.FlexEnd">
|
<MudStack Row="true" Justify="Justify.FlexEnd">
|
||||||
|
|||||||
@@ -132,7 +132,7 @@
|
|||||||
//Filter
|
//Filter
|
||||||
private string? _searchString;
|
private string? _searchString;
|
||||||
private bool _showFilters;
|
private bool _showFilters;
|
||||||
//private bool _showAlreadyAddedEntities = false;
|
private bool _showAlreadyAddedEntities = false;
|
||||||
private IEnumerable<PrivateEntity> FiltertGlobalEntities => _privateEntities.Where(entity =>
|
private IEnumerable<PrivateEntity> FiltertGlobalEntities => _privateEntities.Where(entity =>
|
||||||
(string.IsNullOrWhiteSpace(_searchString) || entity.GlobalEntity.Title.Contains(_searchString, StringComparison.OrdinalIgnoreCase)) //Search bar
|
(string.IsNullOrWhiteSpace(_searchString) || entity.GlobalEntity.Title.Contains(_searchString, StringComparison.OrdinalIgnoreCase)) //Search bar
|
||||||
);
|
);
|
||||||
|
|||||||
+14
-13
@@ -9,8 +9,6 @@
|
|||||||
<PackAsTool>True</PackAsTool>
|
<PackAsTool>True</PackAsTool>
|
||||||
<Version>0.1.0-nightly.10</Version>
|
<Version>0.1.0-nightly.10</Version>
|
||||||
<Authors>Penry</Authors>
|
<Authors>Penry</Authors>
|
||||||
<IsPackable>false</IsPackable>
|
|
||||||
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -62,23 +60,26 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.QuickGrid" Version="10.0.9" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.QuickGrid" Version="10.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="10.0.9" />
|
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="10.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="10.0.9" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="10.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="10.0.9" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="10.0.1" />
|
||||||
<PackageReference Include="Microsoft.Build" Version="18.7.1" />
|
<PackageReference Include="Microsoft.Build" Version="18.0.2" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.9" />
|
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Features" Version="5.0.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.9">
|
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="5.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.DotNet.Scaffolding.Shared" Version="10.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.1">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.9" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.1" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.9" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.1" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.9">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.1">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="MudBlazor" Version="9.6.0" />
|
<PackageReference Include="MudBlazor" Version="9.5.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ using System.Diagnostics.CodeAnalysis;
|
|||||||
|
|
||||||
namespace CouchLog.Data
|
namespace CouchLog.Data
|
||||||
{
|
{
|
||||||
public class GlobalEntity
|
[method: SetsRequiredMembers]
|
||||||
|
public class GlobalEntity()
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 410 KiB |
Reference in new issue
Block a user