using System; using System.Collections.Generic; using System.Net; using System.Web.Http; using Kreta.Ellenorzo.BL.VN.Orarend; using Kreta.Ellenorzo.Domain.VN.Orarend; using Kreta.Ellenorzo.Dto.VN.Exception; using Kreta.Ellenorzo.Dto.VN.Orarend; 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 Kreta.Web.Logging.Abstractions; using Swashbuckle.Examples; using Swashbuckle.Swagger.Annotations; using static Kreta.Ellenorzo.Dto.VN.Converter.ResponseModelConverter; 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.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(EllenorzoExceptionResponseDto))] [SwaggerResponseExample(HttpStatusCode.BadRequest, typeof(ValidaciosHibaExample<OrarendElemListRequest, OrarendElemListRequest>))] [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 OrarendController : ApiController { private readonly ITraceLogger logger; public OrarendController(ITraceLogger traceLogger) { logger = traceLogger; } /// <summary> /// Visszaadja a tanuló órarendi elemeit egy megadott időszakra (tanév rendje eseményeket is) /// </summary> [HttpGet, Route("Sajat/OrarendElemek")] [SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras + DescriptionOneNote.Orarend, typeof(OrarendElemListResponseDto))] //[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<OrarendController, OrarendElemListResponseDto>))] public HashSet<OrarendElemListResponseDto> ListOrarend([FromUri] OrarendElemListRequestDto request) { return ModelToDto(((OrarendFacade)Activator.CreateInstance(typeof(OrarendFacade), FelhasznaloLogic.GetFelhasznalo())).ListOrarend(logger, request)); } /// <summary> /// Órarend elem entitás lekérdezése /// </summary> [HttpGet, Route("Sajat/OrarendElem")] [SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras + DescriptionOneNote.Orarend, typeof(OrarendElemListResponseDto))] //[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<OrarendController, OrarendElemListResponseDto>))] public OrarendElemListResponseDto GetOrarendElem([FromUri] OrarendElemGetRequestDto request) { return ((OrarendFacade)Activator.CreateInstance(typeof(OrarendFacade), FelhasznaloLogic.GetFelhasznalo())).GetOrarendElem(logger, request); } } }