diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI/wwwroot/libs/abp/abp.jquery.js b/src/Volo.Abp.AspNetCore.Mvc.UI/wwwroot/libs/abp/abp.jquery.js index 38b4c3cd0f..c70a78d457 100644 --- a/src/Volo.Abp.AspNetCore.Mvc.UI/wwwroot/libs/abp/abp.jquery.js +++ b/src/Volo.Abp.AspNetCore.Mvc.UI/wwwroot/libs/abp/abp.jquery.js @@ -156,33 +156,33 @@ abp.ui.clearBusy(options.blockUI); } } - }, - - ajaxSendHandler: function (event, request, settings) { - var token = abp.security.antiForgery.getToken(); - if (!token) { - return; - } - - if (!settings.headers || settings.headers[abp.security.antiForgery.tokenHeaderName] === undefined) { - request.setRequestHeader(abp.security.antiForgery.tokenHeaderName, token); - } - } - }); - - $(document).ajaxSend(function (event, request, settings) { - return abp.ajax.ajaxSendHandler(event, request, settings); + }//, + + //ajaxSendHandler: function (event, request, settings) { + // var token = abp.security.antiForgery.getToken(); + // if (!token) { + // return; + // } + + // if (!settings.headers || settings.headers[abp.security.antiForgery.tokenHeaderName] === undefined) { + // request.setRequestHeader(abp.security.antiForgery.tokenHeaderName, token); + // } + //} }); - abp.event.on('abp.dynamicScriptsInitialized', function () { - abp.ajax.defaultError.message = abp.localization.abpWeb('DefaultError'); - abp.ajax.defaultError.details = abp.localization.abpWeb('DefaultErrorDetail'); - abp.ajax.defaultError401.message = abp.localization.abpWeb('DefaultError401'); - abp.ajax.defaultError401.details = abp.localization.abpWeb('DefaultErrorDetail401'); - abp.ajax.defaultError403.message = abp.localization.abpWeb('DefaultError403'); - abp.ajax.defaultError403.details = abp.localization.abpWeb('DefaultErrorDetail403'); - abp.ajax.defaultError404.message = abp.localization.abpWeb('DefaultError404'); - abp.ajax.defaultError404.details = abp.localization.abpWeb('DefaultErrorDetail404'); - }); + //$(document).ajaxSend(function (event, request, settings) { + // return abp.ajax.ajaxSendHandler(event, request, settings); + //}); + + //abp.event.on('abp.dynamicScriptsInitialized', function () { + // abp.ajax.defaultError.message = abp.localization.abpWeb('DefaultError'); + // abp.ajax.defaultError.details = abp.localization.abpWeb('DefaultErrorDetail'); + // abp.ajax.defaultError401.message = abp.localization.abpWeb('DefaultError401'); + // abp.ajax.defaultError401.details = abp.localization.abpWeb('DefaultErrorDetail401'); + // abp.ajax.defaultError403.message = abp.localization.abpWeb('DefaultError403'); + // abp.ajax.defaultError403.details = abp.localization.abpWeb('DefaultErrorDetail403'); + // abp.ajax.defaultError404.message = abp.localization.abpWeb('DefaultError404'); + // abp.ajax.defaultError404.details = abp.localization.abpWeb('DefaultErrorDetail404'); + //}); })(jQuery); \ No newline at end of file diff --git a/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs b/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs index 9dbdd40edb..001bd1b9c9 100644 --- a/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs +++ b/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs @@ -1,4 +1,5 @@ using System; +using Volo.Abp.Threading; namespace Volo.Abp.Http.Modeling { @@ -9,14 +10,14 @@ namespace Volo.Abp.Http.Modeling private ReturnValueApiDescriptionModel() { - + } public static ReturnValueApiDescriptionModel Create(Type type) { return new ReturnValueApiDescriptionModel { - TypeAsString = type.GetFullNameWithAssemblyName() + TypeAsString = AsyncHelper.UnwrapTask(type).GetFullNameWithAssemblyName() }; } } diff --git a/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs b/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs index 99d454bc78..08b2ff4faa 100644 --- a/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs +++ b/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs @@ -68,7 +68,12 @@ namespace Volo.Abp.Identity public async Task DeleteAsync(Guid id) { - var role = await _roleManager.GetByIdAsync(id); + var role = await _roleManager.FindByIdAsync(id.ToString()); + if (role == null) + { + return; + } + await _roleManager.DeleteAsync(role); } } diff --git a/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs b/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs index 7b9425018c..1f853b5822 100644 --- a/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs +++ b/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs @@ -62,7 +62,12 @@ namespace Volo.Abp.Identity public async Task DeleteAsync(Guid id) { - var user = await _userManager.GetByIdAsync(id); + var user = await _userManager.FindByIdAsync(id.ToString()); + if (user == null) + { + return; + } + CheckIdentityErrors(await _userManager.DeleteAsync(user)); } diff --git a/src/Volo.Abp/Volo/Abp/Threading/AsyncHelper.cs b/src/Volo.Abp/Volo/Abp/Threading/AsyncHelper.cs index bf6b5e060d..2b40cd6790 100644 --- a/src/Volo.Abp/Volo/Abp/Threading/AsyncHelper.cs +++ b/src/Volo.Abp/Volo/Abp/Threading/AsyncHelper.cs @@ -17,8 +17,36 @@ namespace Volo.Abp.Threading /// A method to check public static bool IsAsync([NotNull] this MethodInfo method) { - return method.ReturnType == typeof(Task) || - (method.ReturnType.GetTypeInfo().IsGenericType && method.ReturnType.GetGenericTypeDefinition() == typeof(Task<>)); + Check.NotNull(method, nameof(method)); + + return method.ReturnType.IsTaskOrTaskOfT(); + } + + public static bool IsTaskOrTaskOfT([NotNull] this Type type) + { + return type == typeof(Task) || type.GetTypeInfo().IsGenericType && type.GetGenericTypeDefinition() == typeof(Task<>); + } + + /// + /// Returns void if given type is Task. + /// Return T, if given type is Task{T}. + /// Returns given type otherwise. + /// + public static Type UnwrapTask([NotNull] Type type) + { + Check.NotNull(type, nameof(type)); + + if (type == typeof(Task)) + { + return typeof(void); + } + + if (type.GetTypeInfo().IsGenericType && type.GetGenericTypeDefinition() == typeof(Task<>)) + { + return type.GenericTypeArguments[0]; + } + + return type; } ///