Esempio n. 1
0
 public static IActionRouteBuilder Produces <TProduces>(
     this IActionRouteBuilder routeBuilder,
     int statusCode,
     params string[] contentTypes)
 {
     return(routeBuilder.AddFilter(new ApiResponseMetadataProvider <TProduces>(statusCode, contentTypes)));
 }
Esempio n. 2
0
        public static IActionRouteBuilder Cached(
            this IActionRouteBuilder routeBuilder,
            int duration   = 30,
            string header  = null,
            string profile = null,
            bool noStore   = false,
            string[] query = null)
        {
            var filter = new ResponseCacheAttribute
            {
                Duration         = duration,
                NoStore          = noStore,
                VaryByHeader     = header,
                CacheProfileName = profile,
                VaryByQueryKeys  = query
            };

            return(routeBuilder.AddFilter(filter));
        }
Esempio n. 3
0
 public static IActionRouteBuilder Consumes(
     this IActionRouteBuilder routeBuilder,
     params string[] contentTypes)
 {
     return(routeBuilder.AddFilter(new ApiRequestMetadataProvider(contentTypes)));
 }
Esempio n. 4
0
 public static IActionRouteBuilder HttpMethod(
     this IActionRouteBuilder builder,
     params string[] httpMethods)
 {
     return(builder.AddConstraint(new HttpMethodActionConstraint(httpMethods)));
 }
Esempio n. 5
0
 public static IActionRouteBuilder HttpOptions(
     this IActionRouteBuilder builder)
 {
     return(builder.HttpMethod(HttpMethods.Options));
 }
Esempio n. 6
0
 public static IActionRouteBuilder HttpDelete(
     this IActionRouteBuilder builder)
 {
     return(builder.HttpMethod(HttpMethods.Delete));
 }
Esempio n. 7
0
 public static IActionRouteBuilder HttpPatch(
     this IActionRouteBuilder builder)
 {
     return(builder.HttpMethod(HttpMethods.Patch));
 }
Esempio n. 8
0
 public static IActionRouteBuilder HttpGet(
     this IActionRouteBuilder builder)
 {
     return(builder.HttpMethod(HttpMethods.Get));
 }
Esempio n. 9
0
 public static IActionRouteBuilder HttpHead(
     this IActionRouteBuilder builder)
 {
     return(builder.HttpMethod(HttpMethods.Head));
 }