From d1816d4a72a870adb497087c81a93c22057582c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 27 Sep 2017 18:24:25 +0300 Subject: [PATCH] Refactor. --- .../Abp/AspNetCore/Mvc/AbpAppServiceConvention.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAppServiceConvention.cs b/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAppServiceConvention.cs index 0cf35e54e9..48baee0ff0 100644 --- a/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAppServiceConvention.cs +++ b/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAppServiceConvention.cs @@ -240,12 +240,14 @@ namespace Volo.Abp.AspNetCore.Mvc protected virtual AttributeRouteModel CreateAbpServiceAttributeRouteModel(string rootPath, string controllerName, ActionModel action, string httpMethod) { - var url = CalculateUrl(rootPath, controllerName, action, httpMethod); - - return new AttributeRouteModel(new RouteAttribute(url)); + return new AttributeRouteModel( + new RouteAttribute( + CalculateRouteTemplate(rootPath, controllerName, action, httpMethod) + ) + ); } - protected virtual string CalculateUrl(string rootPath, string controllerName, ActionModel action, string httpMethod) + protected virtual string CalculateRouteTemplate(string rootPath, string controllerName, ActionModel action, string httpMethod) { var url = $"api/{rootPath}/{controllerName.ToCamelCase()}"; @@ -254,7 +256,7 @@ namespace Volo.Abp.AspNetCore.Mvc { url += "/{id}"; } - + //Add action name if needed var actionNameInUrl = NormalizeUrlActionName(rootPath, controllerName, action, httpMethod); if (!actionNameInUrl.IsNullOrEmpty())