Set api definition return value void for task.

pull/179/head
Halil İbrahim Kalkan 7 years ago
parent fefae25f7f
commit 07b227ea7b

@ -156,33 +156,33 @@
abp.ui.clearBusy(options.blockUI); abp.ui.clearBusy(options.blockUI);
} }
} }
}, }//,
ajaxSendHandler: function (event, request, settings) { //ajaxSendHandler: function (event, request, settings) {
var token = abp.security.antiForgery.getToken(); // var token = abp.security.antiForgery.getToken();
if (!token) { // if (!token) {
return; // return;
} // }
if (!settings.headers || settings.headers[abp.security.antiForgery.tokenHeaderName] === undefined) { // if (!settings.headers || settings.headers[abp.security.antiForgery.tokenHeaderName] === undefined) {
request.setRequestHeader(abp.security.antiForgery.tokenHeaderName, token); // request.setRequestHeader(abp.security.antiForgery.tokenHeaderName, token);
} // }
} //}
}); });
$(document).ajaxSend(function (event, request, settings) { //$(document).ajaxSend(function (event, request, settings) {
return abp.ajax.ajaxSendHandler(event, request, settings); // return abp.ajax.ajaxSendHandler(event, request, settings);
}); //});
abp.event.on('abp.dynamicScriptsInitialized', function () { //abp.event.on('abp.dynamicScriptsInitialized', function () {
abp.ajax.defaultError.message = abp.localization.abpWeb('DefaultError'); // abp.ajax.defaultError.message = abp.localization.abpWeb('DefaultError');
abp.ajax.defaultError.details = abp.localization.abpWeb('DefaultErrorDetail'); // abp.ajax.defaultError.details = abp.localization.abpWeb('DefaultErrorDetail');
abp.ajax.defaultError401.message = abp.localization.abpWeb('DefaultError401'); // abp.ajax.defaultError401.message = abp.localization.abpWeb('DefaultError401');
abp.ajax.defaultError401.details = abp.localization.abpWeb('DefaultErrorDetail401'); // abp.ajax.defaultError401.details = abp.localization.abpWeb('DefaultErrorDetail401');
abp.ajax.defaultError403.message = abp.localization.abpWeb('DefaultError403'); // abp.ajax.defaultError403.message = abp.localization.abpWeb('DefaultError403');
abp.ajax.defaultError403.details = abp.localization.abpWeb('DefaultErrorDetail403'); // abp.ajax.defaultError403.details = abp.localization.abpWeb('DefaultErrorDetail403');
abp.ajax.defaultError404.message = abp.localization.abpWeb('DefaultError404'); // abp.ajax.defaultError404.message = abp.localization.abpWeb('DefaultError404');
abp.ajax.defaultError404.details = abp.localization.abpWeb('DefaultErrorDetail404'); // abp.ajax.defaultError404.details = abp.localization.abpWeb('DefaultErrorDetail404');
}); //});
})(jQuery); })(jQuery);

@ -1,4 +1,5 @@
using System; using System;
using Volo.Abp.Threading;
namespace Volo.Abp.Http.Modeling namespace Volo.Abp.Http.Modeling
{ {
@ -16,7 +17,7 @@ namespace Volo.Abp.Http.Modeling
{ {
return new ReturnValueApiDescriptionModel return new ReturnValueApiDescriptionModel
{ {
TypeAsString = type.GetFullNameWithAssemblyName() TypeAsString = AsyncHelper.UnwrapTask(type).GetFullNameWithAssemblyName()
}; };
} }
} }

@ -68,7 +68,12 @@ namespace Volo.Abp.Identity
public async Task DeleteAsync(Guid id) 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); await _roleManager.DeleteAsync(role);
} }
} }

@ -62,7 +62,12 @@ namespace Volo.Abp.Identity
public async Task DeleteAsync(Guid id) 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)); CheckIdentityErrors(await _userManager.DeleteAsync(user));
} }

@ -17,8 +17,36 @@ namespace Volo.Abp.Threading
/// <param name="method">A method to check</param> /// <param name="method">A method to check</param>
public static bool IsAsync([NotNull] this MethodInfo method) public static bool IsAsync([NotNull] this MethodInfo method)
{ {
return method.ReturnType == typeof(Task) || Check.NotNull(method, nameof(method));
(method.ReturnType.GetTypeInfo().IsGenericType && method.ReturnType.GetGenericTypeDefinition() == typeof(Task<>));
return method.ReturnType.IsTaskOrTaskOfT();
}
public static bool IsTaskOrTaskOfT([NotNull] this Type type)
{
return type == typeof(Task) || type.GetTypeInfo().IsGenericType && type.GetGenericTypeDefinition() == typeof(Task<>);
}
/// <summary>
/// Returns void if given type is Task.
/// Return T, if given type is Task{T}.
/// Returns given type otherwise.
/// </summary>
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;
} }
/// <summary> /// <summary>

Loading…
Cancel
Save