add ReturnsAttribute to make annotating API more convenient
This commit is contained in:
parent
08bd5c31e0
commit
d2006b52e1
|
@ -0,0 +1,22 @@
|
||||||
|
using System.Net;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace Innovenergy.Backend.Controllers;
|
||||||
|
|
||||||
|
public class ReturnsAttribute : ProducesResponseTypeAttribute
|
||||||
|
{
|
||||||
|
public ReturnsAttribute(HttpStatusCode statusCode) : base((Int32)statusCode)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ReturnsAttribute<T> : ProducesResponseTypeAttribute
|
||||||
|
{
|
||||||
|
public ReturnsAttribute(HttpStatusCode statusCode) : base(typeof(T), (Int32)statusCode)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReturnsAttribute() : base(typeof(T), (Int32)HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue