diff --git a/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs b/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs index 19ace62aca..ea7e2236ef 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs @@ -494,17 +494,17 @@ namespace Volo.Abp.BlazoriseUI await HandleErrorAsync(ex); } } - + protected virtual Task OnDeletingEntityAsync() { return Task.CompletedTask; } - + protected virtual async Task OnDeletedEntityAsync() { await GetEntitiesAsync(); await InvokeAsync(StateHasChanged); - } + } protected virtual string GetDeleteConfirmationMessage(TListViewModel entity) { @@ -596,7 +596,7 @@ namespace Volo.Abp.BlazoriseUI if (propertyInfo.Type.IsEnum) { column.ValueConverter = (val) => - EnumHelper.GetLocalizedMemberName(propertyInfo.Type, val, StringLocalizerFactory); + EnumHelper.GetLocalizedMemberName(propertyInfo.Type, val.As().ExtraProperties[propertyInfo.Name], StringLocalizerFactory); } yield return column; diff --git a/framework/src/Volo.Abp.ObjectExtending/Volo/Abp/Data/ExtraPropertyDictionaryExtensions.cs b/framework/src/Volo.Abp.ObjectExtending/Volo/Abp/Data/ExtraPropertyDictionaryExtensions.cs new file mode 100644 index 0000000000..0c6b9dff67 --- /dev/null +++ b/framework/src/Volo.Abp.ObjectExtending/Volo/Abp/Data/ExtraPropertyDictionaryExtensions.cs @@ -0,0 +1,30 @@ +using System; + +namespace Volo.Abp.Data +{ + public static class ExtraPropertyDictionaryExtensions + { + public static T ToEnum(this ExtraPropertyDictionary extraPropertyDictionary, string key) + where T : Enum + { + if (extraPropertyDictionary[key].GetType() == typeof(T)) + { + return (T)extraPropertyDictionary[key]; + } + + extraPropertyDictionary[key] = Enum.Parse(typeof(T), extraPropertyDictionary[key].ToString(), ignoreCase: true); + return (T)extraPropertyDictionary[key]; + } + + public static object ToEnum(this ExtraPropertyDictionary extraPropertyDictionary, string key, Type enumType) + { + if (!enumType.IsEnum || extraPropertyDictionary[key].GetType() == enumType) + { + return extraPropertyDictionary[key]; + } + + extraPropertyDictionary[key] = Enum.Parse(enumType, extraPropertyDictionary[key].ToString(), ignoreCase: true); + return extraPropertyDictionary[key]; + } + } +} diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml index 02a24b4084..4ebac325fb 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml @@ -30,6 +30,10 @@ { if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty()) { + if (propertyInfo.Type.IsEnum) + { + Model.Role.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type); + }