62 lines
4 KiB
C#
62 lines
4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Net;
|
|
using System.Web.Http;
|
|
using Kreta.Ellenorzo.BL.VN.HaziFeladat;
|
|
using Kreta.Ellenorzo.Domain.VN.HaziFeladat;
|
|
using Kreta.Ellenorzo.Dto.VN.Exception;
|
|
using Kreta.Ellenorzo.Dto.VN.HaziFeladat;
|
|
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;
|
|
using static Kreta.Ellenorzo.Dto.VN.Converter.ResponseModelConverter;
|
|
|
|
namespace Kreta.Ellenorzo.WebApi.VN.Controllers
|
|
{
|
|
[ApiKeyAuthorization]
|
|
[IdpAuthorize(FelhasznaloSzerepkor.Tanulo, FelhasznaloSzerepkor.Gondviselo)]
|
|
[RoutePrefix(Constants.RoutePrefix + "/Sajat")]
|
|
[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))]
|
|
#pragma warning disable S1200 // Classes should not be coupled to too many other classes (Single Responsibility Principle)
|
|
public class HaziFeladatController : ApiController
|
|
#pragma warning restore S1200 // Classes should not be coupled to too many other classes (Single Responsibility Principle)
|
|
{
|
|
/// <summary>
|
|
/// Házi feladat entitás lekérdezése
|
|
/// </summary>
|
|
/// <param name="uid">Házi feladat Uid filter</param>
|
|
[HttpGet, Route("HaziFeladatok/{uid}")]
|
|
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras + DescriptionOneNote.HaziFeladatok, typeof(HaziFeladatDetailResponseDto))]
|
|
//[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyExampleProvider<HaziFeladatController, HaziFeladatDataListResponseDto>))]
|
|
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
|
|
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
|
public HaziFeladatDetailResponseDto GetHaziFeladat(string uid)
|
|
{
|
|
return ((HaziFeladatFacade)Activator.CreateInstance(typeof(HaziFeladatFacade), FelhasznaloLogic.GetFelhasznalo())).GetHaziFeladat(uid);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Házi feladatok lekérdezése határidő alapján
|
|
/// </summary>
|
|
[HttpGet, Route("HaziFeladatok")]
|
|
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras + DescriptionOneNote.HaziFeladatok, typeof(HaziFeladatListResponseDto))]
|
|
//[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<HaziFeladatController, HaziFeladatListResponseDto>))]
|
|
[SwaggerResponse(HttpStatusCode.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
|
|
[SwaggerResponseExample(HttpStatusCode.BadRequest, typeof(ValidaciosHibaExample<HaziFeladatListRequest, HaziFeladatListRequest>))]
|
|
public HashSet<HaziFeladatListResponseDto> ListHaziFeladat([FromUri] HaziFeladatListRequestDto request)
|
|
{
|
|
return ModelToDto(((HaziFeladatFacade)Activator.CreateInstance(typeof(HaziFeladatFacade), FelhasznaloLogic.GetFelhasznalo())).ListHaziFeladat(request));
|
|
}
|
|
}
|
|
}
|