Browse Source

Refactor.

pull/116/head
Halil İbrahim Kalkan 9 years ago
parent
commit
d1816d4a72
  1. 12
      src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAppServiceConvention.cs

12
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) protected virtual AttributeRouteModel CreateAbpServiceAttributeRouteModel(string rootPath, string controllerName, ActionModel action, string httpMethod)
{ {
var url = CalculateUrl(rootPath, controllerName, action, httpMethod); return new AttributeRouteModel(
new RouteAttribute(
return new AttributeRouteModel(new RouteAttribute(url)); 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()}"; var url = $"api/{rootPath}/{controllerName.ToCamelCase()}";
@ -254,7 +256,7 @@ namespace Volo.Abp.AspNetCore.Mvc
{ {
url += "/{id}"; url += "/{id}";
} }
//Add action name if needed //Add action name if needed
var actionNameInUrl = NormalizeUrlActionName(rootPath, controllerName, action, httpMethod); var actionNameInUrl = NormalizeUrlActionName(rootPath, controllerName, action, httpMethod);
if (!actionNameInUrl.IsNullOrEmpty()) if (!actionNameInUrl.IsNullOrEmpty())

Loading…
Cancel
Save