61 lines
3.4 KiB
C#
61 lines
3.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Net;
|
|
using System.Web.Http;
|
|
using Kreta.Naplo.BusinessLogic.V3.Igazolas;
|
|
using Kreta.Naplo.Domain.V3.Enum;
|
|
using Kreta.Naplo.Dto.V3.Exception;
|
|
using Kreta.Naplo.Dto.V3.Igazolas;
|
|
using Kreta.Naplo.WebApi.FilterAttributes;
|
|
using Kreta.Naplo.WebApi.V3.Common.Logic;
|
|
using Kreta.Naplo.WebApi.V3.Documentation;
|
|
using Swashbuckle.Examples;
|
|
using Swashbuckle.Swagger.Annotations;
|
|
using static Kreta.Naplo.Dto.V3.Converter.ResponseModelConverter;
|
|
|
|
namespace Kreta.Naplo.WebApi.V3.Controllers
|
|
{
|
|
[ApiKeyAuthorization]
|
|
[IdpAuthorize(FelhasznaloSzerepkor.Tanar)]
|
|
[RoutePrefix(Constants.RoutePrefix)]
|
|
[SwaggerResponse(HttpStatusCode.InternalServerError, DescriptionLookUp.IsmeretlenHibaTortentResponseLeiras, typeof(NaploExceptionResponseDto))]
|
|
[SwaggerResponseExample(HttpStatusCode.InternalServerError, typeof(IsmeretlenHibaExample))]
|
|
[SwaggerResponse(HttpStatusCode.Unauthorized, DescriptionLookUp.JogosulatlanTokenLejartResponseLeiras, typeof(string))]
|
|
[SwaggerResponseExample(HttpStatusCode.Unauthorized, typeof(LejartTokenExample))]
|
|
[SwaggerResponse(HttpStatusCode.Forbidden, DescriptionLookUp.HozzaferesMegtagadvaResponseLeiras, typeof(string))]
|
|
[SwaggerResponseExample(HttpStatusCode.Forbidden, typeof(PermissionDeniedExample))]
|
|
[SwaggerResponse(HttpStatusCode.RequestTimeout, DescriptionLookUp.KeresTullepteMaxFutasiIdot, typeof(NaploExceptionResponseDto))]
|
|
[SwaggerResponseExample(HttpStatusCode.RequestTimeout, typeof(TimeOutExample))]
|
|
[SwaggerResponse(HttpStatusCode.Conflict, DescriptionLookUp.TanevetValtottAzIntezmeny, typeof(NaploExceptionResponseDto))]
|
|
[SwaggerResponseExample(HttpStatusCode.Conflict, typeof(IntezmenyMarTanevetValtottExample))]
|
|
public class IgazolasController : ApiController
|
|
{
|
|
[HttpGet, Route("Igazolas")]
|
|
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.IgazolasResponseLeiras, typeof(IgazolasResponseDto))]
|
|
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<IgazolasController, IgazolasResponseDto>))]
|
|
public IEnumerable<IgazolasResponseDto> GetIgazolas([FromUri] int tanuloId)
|
|
{
|
|
return ModelToDto(((IgazolasFacade)Activator.CreateInstance(typeof(IgazolasFacade), FelhasznaloLogic.GetFelhasznalo())).GetIgazolas(tanuloId));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Igazolás rögzítése
|
|
/// </summary>
|
|
[HttpPost, Route("Igazolas")]
|
|
[SwaggerResponse(HttpStatusCode.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(NaploExceptionResponseDto))]
|
|
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.IgazolasMenteseSikeres, typeof(void))]
|
|
public void CreateIgazolas(IgazolasCreateRequestDto request)
|
|
{
|
|
((IgazolasFacade)Activator.CreateInstance(typeof(IgazolasFacade), FelhasznaloLogic.GetFelhasznalo())).CreateIgazolas(request);
|
|
}
|
|
|
|
[HttpDelete, Route("Igazolas/{id}")]
|
|
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(NaploExceptionResponseDto))]
|
|
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
|
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.IgazolasTorlesSikeres)]
|
|
public void DeleteIgazolas([FromUri] int id)
|
|
{
|
|
((IgazolasFacade)Activator.CreateInstance(typeof(IgazolasFacade), FelhasznaloLogic.GetFelhasznalo())).DeleteIgazolas(id);
|
|
}
|
|
}
|
|
}
|