32 lines
802 B
C#
32 lines
802 B
C#
using KJD_Web.Controllers;
|
|
using System.Linq;
|
|
using System.Net.Http;
|
|
using System.Web.Http.Controllers;
|
|
|
|
namespace KJD_Web
|
|
{
|
|
public class GetPostActionSelector : ApiControllerActionSelector
|
|
{
|
|
public override ILookup<string, HttpActionDescriptor> GetActionMapping(
|
|
HttpControllerDescriptor controllerDescriptor)
|
|
{
|
|
var mapping = base.GetActionMapping(controllerDescriptor);
|
|
if (mapping == null)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
if (typeof(AsmxApiController).IsAssignableFrom(controllerDescriptor.ControllerType))
|
|
{
|
|
foreach (var action in mapping.SelectMany(group => group).Distinct())
|
|
{
|
|
action.SupportedHttpMethods.Clear();
|
|
action.SupportedHttpMethods.Add(HttpMethod.Get);
|
|
action.SupportedHttpMethods.Add(HttpMethod.Post);
|
|
}
|
|
}
|
|
|
|
return mapping;
|
|
}
|
|
}
|
|
} |