add ReturnsAttribute to make annotating API more convenient

This commit is contained in:
ig 2023-02-24 12:57:51 +01:00
parent 08bd5c31e0
commit d2006b52e1
1 changed files with 22 additions and 0 deletions

View File

@ -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)
{
}
}