Shady nagy/net6 (#614)
* udated to .net6 * used the .net6 version RC2 * added editconfig. * App core new Scoped Namespaces style. * BlazorAdmin new Scoped Namespaces style. * Blazor Shared new Scoped Namespaces style. * Infra new Scoped Namespaces style. * public api new Scoped Namespaces style. * web new Scoped Namespaces style. * FunctionalTests new Scoped Namespaces style. * Integrational tests new Scoped Namespaces style. * unit tests new Scoped Namespaces style. * update github action. * update github action. * change the global.
This commit is contained in:
@@ -1,38 +1,37 @@
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
|
||||
namespace BlazorAdmin.Shared
|
||||
namespace BlazorAdmin.Shared;
|
||||
|
||||
/// <summary>
|
||||
/// This is needed until 5.0 ships with native support
|
||||
/// https://www.pragimtech.com/blog/blazor/inputselect-does-not-support-system.int32/
|
||||
/// </summary>
|
||||
/// <typeparam name="TValue"></typeparam>
|
||||
public class CustomInputSelect<TValue> : InputSelect<TValue>
|
||||
{
|
||||
/// <summary>
|
||||
/// This is needed until 5.0 ships with native support
|
||||
/// https://www.pragimtech.com/blog/blazor/inputselect-does-not-support-system.int32/
|
||||
/// </summary>
|
||||
/// <typeparam name="TValue"></typeparam>
|
||||
public class CustomInputSelect<TValue> : InputSelect<TValue>
|
||||
protected override bool TryParseValueFromString(string value, out TValue result,
|
||||
out string validationErrorMessage)
|
||||
{
|
||||
protected override bool TryParseValueFromString(string value, out TValue result,
|
||||
out string validationErrorMessage)
|
||||
if (typeof(TValue) == typeof(int))
|
||||
{
|
||||
if (typeof(TValue) == typeof(int))
|
||||
if (int.TryParse(value, out var resultInt))
|
||||
{
|
||||
if (int.TryParse(value, out var resultInt))
|
||||
{
|
||||
result = (TValue)(object)resultInt;
|
||||
validationErrorMessage = null;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = default;
|
||||
validationErrorMessage =
|
||||
$"The selected value {value} is not a valid number.";
|
||||
return false;
|
||||
}
|
||||
result = (TValue)(object)resultInt;
|
||||
validationErrorMessage = null;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return base.TryParseValueFromString(value, out result,
|
||||
out validationErrorMessage);
|
||||
result = default;
|
||||
validationErrorMessage =
|
||||
$"The selected value {value} is not a valid number.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return base.TryParseValueFromString(value, out result,
|
||||
out validationErrorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user