43 lines
1.4 KiB
C#
43 lines
1.4 KiB
C#
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using Microsoft.AspNet.Mvc.Routing;
|
|
|
|
namespace Microsoft.AspNet.Mvc
|
|
{
|
|
/// <summary>
|
|
/// Identifies an action that only supports the HTTP PUT method.
|
|
/// </summary>
|
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
|
|
public class HttpPutAttribute : Attribute, IActionHttpMethodProvider, IRouteTemplateProvider
|
|
{
|
|
private static readonly IEnumerable<string> _supportedMethods = new string[] { "PUT" };
|
|
|
|
/// <summary>
|
|
/// Creates a new <see cref="HttpPutAttribute"/>.
|
|
/// </summary>
|
|
public HttpPutAttribute()
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates a new <see cref="HttpPutAttribute"/> with the given route template.
|
|
/// </summary>
|
|
/// <param name="template">The route template. May not be null.</param>
|
|
public HttpPutAttribute([NotNull] string template)
|
|
{
|
|
Template = template;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<string> HttpMethods
|
|
{
|
|
get { return _supportedMethods; }
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public string Template { get; private set; }
|
|
}
|
|
} |