70 lines
4 KiB
C#
70 lines
4 KiB
C#
using System;
|
|
using System.Net;
|
|
using System.Web.Http;
|
|
using Kreta.Ellenorzo.BL.VN.Felhasznalo;
|
|
using Kreta.Ellenorzo.Dto.VN.Exception;
|
|
using Kreta.Ellenorzo.Dto.VN.Felhasznalo.Gondviselo;
|
|
using Kreta.Ellenorzo.Enums;
|
|
using Kreta.Ellenorzo.Web.FilterAttributes;
|
|
using Kreta.Ellenorzo.WebApi.FilterAttributes;
|
|
using Kreta.Ellenorzo.WebApi.VN.Documentation;
|
|
using Kreta.Ellenorzo.WebApi.VN.Logic;
|
|
using Swashbuckle.Examples;
|
|
using Swashbuckle.Swagger.Annotations;
|
|
|
|
namespace Kreta.Ellenorzo.WebApi.VN.Controllers
|
|
{
|
|
[ApiKeyAuthorization]
|
|
[IdpAuthorize(FelhasznaloSzerepkor.Tanulo, FelhasznaloSzerepkor.Gondviselo)]
|
|
[RoutePrefix(Constants.RoutePrefix)]
|
|
[SwaggerResponse(HttpStatusCode.InternalServerError, DescriptionLookUp.IsmeretlenHibaTortentResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
|
|
[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.Conflict, DescriptionLookUp.TanevetValtottAzIntezmeny, typeof(EllenorzoExceptionResponseDto))]
|
|
[SwaggerResponseExample(HttpStatusCode.Conflict, typeof(IntezmenyMarTanevetValtottExample))]
|
|
public class TargyiEszkozController : ApiController
|
|
{
|
|
/// <summary>
|
|
/// Gondviselő eszköz igényléshez szükséges adatainak elküldése
|
|
/// </summary>
|
|
[HttpPost, Route("TargyiEszkoz/Regisztracio")]
|
|
[IdpAuthorize(FelhasznaloSzerepkor.Gondviselo)]
|
|
[SwaggerResponse(HttpStatusCode.NoContent, DescriptionLookUp.GondviseloEszkozIgenylesAdatokRogziteseSikeres)]
|
|
[SwaggerRequestExample(typeof(RegisztracioRequestDto), typeof(RegisztracioRequestDto))]
|
|
public void PostGondviseloEszkozIgenyles(RegisztracioRequestDto request)
|
|
{
|
|
((TargyiEszkozFacade)Activator.CreateInstance(typeof(TargyiEszkozFacade), FelhasznaloLogic.GetFelhasznalo())).SaveGondviseloEszkozIgenyles(request);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gondviselő regisztrált-e már
|
|
/// </summary>
|
|
[HttpGet, Route("TargyiEszkoz/IsRegisztralt")]
|
|
[IdpAuthorize(FelhasznaloSzerepkor.Gondviselo)]
|
|
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.IsRegisztraltResponseLeiras)]
|
|
//[SwaggerResponseExample(HttpStatusCode.OK, typeof(bool))]
|
|
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras + DescriptionLookUp.GonviseloTorolveLett, typeof(EllenorzoExceptionResponseDto))]
|
|
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
|
public bool? IsRegisztralt()
|
|
{
|
|
return ((TargyiEszkozFacade)Activator.CreateInstance(typeof(TargyiEszkozFacade), FelhasznaloLogic.GetFelhasznalo())).IsRegisztralt();
|
|
}
|
|
|
|
/// <summary>
|
|
/// A gondviselőhöz tartozó tanulónak van-e már kiosztott eszköze
|
|
/// </summary>
|
|
[HttpGet, Route("TargyiEszkoz/IsEszkozKiosztva")]
|
|
[IdpAuthorize(FelhasznaloSzerepkor.Tanulo, FelhasznaloSzerepkor.Gondviselo)]
|
|
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.IsEszkozKiosztvaResponseLeiras)]
|
|
//[SwaggerResponseExample(HttpStatusCode.OK, typeof(bool))]
|
|
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras + DescriptionLookUp.GonviseloTorolveLett, typeof(EllenorzoExceptionResponseDto))]
|
|
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
|
public bool IsEszkozKiosztva()
|
|
{
|
|
return ((TargyiEszkozFacade)Activator.CreateInstance(typeof(TargyiEszkozFacade), FelhasznaloLogic.GetFelhasznalo())).IsEszkozKiosztva();
|
|
}
|
|
}
|
|
}
|