Initial commit
This commit is contained in:
52
GerstITS.Examples.Api/Controllers/1.0/ExampleController.cs
Normal file
52
GerstITS.Examples.Api/Controllers/1.0/ExampleController.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using GerstITS.Examples.Api.Versioning;
|
||||
using GerstITS.Examples.Logic.Example;
|
||||
using GerstITS.Validation;
|
||||
using GerstITS.Web.Api;
|
||||
using GerstITS.Web.Api.FluentApi;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace GerstITS.Examples.Api.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// Controller is deprecated use newer version.
|
||||
/// </summary>
|
||||
[ApiController,
|
||||
ApiVersion(Versions._1_0, Deprecated = true),
|
||||
Route(ApplicationEnvironment.WebApi.ControllerRouteTemplate)]
|
||||
public class ExampleController : FluentApiControllerBase
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private readonly IExampleProvider _provider;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public ExampleController(IExampleProvider provider,
|
||||
IValidator validator)
|
||||
: base(validator)
|
||||
{
|
||||
_provider = provider;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Gets the example data by id.
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns>Returns Example data.</returns>
|
||||
[HttpGet,
|
||||
Route("{id}")]
|
||||
public IActionResult Get(int id)
|
||||
{
|
||||
return Api().Use(id)
|
||||
.Get(_provider.GetById);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user