using System; using System.Collections.Generic; using System.Net; using System.Web.Http; using Kreta.Naplo.BusinessLogic.V3.Tanar; using Kreta.Naplo.Domain.V3.Enum; using Kreta.Naplo.Dto.V3.Exception; using Kreta.Naplo.Dto.V3.Tanar; 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 + "/Tanar")] [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 TanarController : ApiController { [HttpGet, Route("Profil")] [SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.TanarAdataiResponseLeiras, typeof(ProfilResponseDto))] [SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyExampleProvider))] public ProfilResponseDto GetProfil() { return ((TanarFacade)Activator.CreateInstance(typeof(TanarFacade), FelhasznaloLogic.GetFelhasznalo())).GetProfil(); } [HttpGet, Route("Beallitasok")] [SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.TanarBeallitasokResponseLeiras, typeof(BeallitasokResponseDto))] [SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyExampleProvider))] public BeallitasokResponseDto GetBeallitasok() { return ((TanarFacade)Activator.CreateInstance(typeof(TanarFacade), FelhasznaloLogic.GetFelhasznalo())).GetBeallitasok(); } [HttpPost, Route("Beallitasok")] [SwaggerResponse(HttpStatusCode.NoContent, DescriptionLookUp.BeallitasRogzitesSikeres)] [SwaggerRequestExample(typeof(BeallitasokRequestDto), typeof(BeallitasokRequestDto))] public void PostBeallitasok(BeallitasokRequestDto request) { ((TanarFacade)Activator.CreateInstance(typeof(TanarFacade), FelhasznaloLogic.GetFelhasznalo())).PostBeallitasok(request); } [HttpGet, Route("Tantargyfelosztas")] [SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.TanarTantargyFelosztasai, typeof(TantargyFelosztasResponseDto))] [SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(NaploExceptionResponseDto))] [SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))] public IEnumerable GetOsztalyCsoportTantargyak() { return ModelToDto(((TanarFacade)Activator.CreateInstance(typeof(TanarFacade), FelhasznaloLogic.GetFelhasznalo())).GetTantargyFelosztas()); } } }