|
|
|
@ -4,7 +4,7 @@ |
|
|
|
|
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire. |
|
|
|
|
* |
|
|
|
|
* OpenAPI spec version: 1.3.4 |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* Generated by: https://github.com/swagger-api/swagger-codegen.git |
|
|
|
|
*/ |
|
|
|
|
using System; |
|
|
|
@ -18,17 +18,27 @@ using IO.Swagger.Attributes; |
|
|
|
|
using IO.Swagger.Security; |
|
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
|
using IO.Swagger.DTO; |
|
|
|
|
using EPAServeur.IServices; |
|
|
|
|
using System.Reflection.Metadata.Ecma335; |
|
|
|
|
using System.Runtime.InteropServices.WindowsRuntime; |
|
|
|
|
|
|
|
|
|
namespace IO.Swagger.Controllers |
|
|
|
|
{ |
|
|
|
|
{ |
|
|
|
|
/// <summary> |
|
|
|
|
/// |
|
|
|
|
/// |
|
|
|
|
/// </summary> |
|
|
|
|
[ApiController] |
|
|
|
|
public class FormationsApiController : ControllerBase |
|
|
|
|
{ |
|
|
|
|
{ |
|
|
|
|
private readonly IFormationService formationService; |
|
|
|
|
|
|
|
|
|
public FormationsApiController(IFormationService _formationService) |
|
|
|
|
{ |
|
|
|
|
formationService = _formationService; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// |
|
|
|
|
/// |
|
|
|
|
/// </summary> |
|
|
|
|
/// <remarks>Ajouter une nouvelle formation</remarks> |
|
|
|
|
/// <param name="body"></param> |
|
|
|
@ -36,23 +46,27 @@ namespace IO.Swagger.Controllers |
|
|
|
|
/// <response code="403">Acces interdit</response> |
|
|
|
|
[HttpPost] |
|
|
|
|
[Route("/api/formations")] |
|
|
|
|
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
[ValidateModelState] |
|
|
|
|
[SwaggerOperation("AjouterFormation")] |
|
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
|
public virtual IActionResult AjouterFormation([FromBody]FormationDTO body) |
|
|
|
|
{ |
|
|
|
|
//TODO: Uncomment the next line to return response 201 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(201); |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(403, default(ErreurDTO)); |
|
|
|
|
|
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
public virtual IActionResult AjouterFormation([FromBody] FormationDTO body) |
|
|
|
|
{ |
|
|
|
|
FormationDTO nouvelleFormation = formationService.AddFormation(body); |
|
|
|
|
|
|
|
|
|
return Created("", nouvelleFormation); |
|
|
|
|
//if (body.Id != null && body.Id > 0) |
|
|
|
|
//{ |
|
|
|
|
// return StatusCode(201, body); |
|
|
|
|
//} |
|
|
|
|
//else |
|
|
|
|
//{ |
|
|
|
|
// return NotFound(); |
|
|
|
|
//} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// |
|
|
|
|
/// |
|
|
|
|
/// </summary> |
|
|
|
|
/// <remarks>Supprimer une formation</remarks> |
|
|
|
|
/// <param name="idFormation">id formation</param> |
|
|
|
@ -60,23 +74,26 @@ namespace IO.Swagger.Controllers |
|
|
|
|
/// <response code="403">Acces interdit</response> |
|
|
|
|
[HttpDelete] |
|
|
|
|
[Route("/api/formations/{idFormation}/supprimer")] |
|
|
|
|
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
[ValidateModelState] |
|
|
|
|
[SwaggerOperation("DeleteFormation")] |
|
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
|
public virtual IActionResult DeleteFormation([FromRoute][Required]long? idFormation) |
|
|
|
|
{ |
|
|
|
|
//TODO: Uncomment the next line to return response 204 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(204); |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(403, default(ErreurDTO)); |
|
|
|
|
|
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
public virtual IActionResult DeleteFormation([FromRoute][Required] long? idFormation) |
|
|
|
|
{ |
|
|
|
|
if (!formationService.DeleteFormationById(idFormation)) |
|
|
|
|
{ |
|
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
|
|
{ |
|
|
|
|
Code = "404", |
|
|
|
|
Message = "Aucune formation trouvée" |
|
|
|
|
}; |
|
|
|
|
return NotFound(erreur); |
|
|
|
|
} |
|
|
|
|
return NoContent(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// |
|
|
|
|
/// |
|
|
|
|
/// </summary> |
|
|
|
|
/// <remarks>Récupérer les formations annulées</remarks> |
|
|
|
|
/// <param name="asc">Préciser si les données sont dans l'ordre (true) ou dans l'ordre inverse (false)</param> |
|
|
|
@ -90,33 +107,31 @@ namespace IO.Swagger.Controllers |
|
|
|
|
/// <response code="404">Ressource n'a pas été trouvée</response> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("/api/formations/annulees")] |
|
|
|
|
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
[ValidateModelState] |
|
|
|
|
[SwaggerOperation("GetFormationAnnulees")] |
|
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<FormationDetailsDTO>), description: "OK")] |
|
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
|
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n'a pas été trouvée")] |
|
|
|
|
public virtual IActionResult GetFormationAnnulees([FromQuery][Required()]bool? asc, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]long? idAgence, [FromQuery]string texte, [FromQuery]string tri) |
|
|
|
|
{ |
|
|
|
|
public virtual IActionResult GetFormationAnnulees([FromQuery][Required()] bool? asc, [FromQuery][Required()] int? numPage, [FromQuery][Required()] int? parPAge, [FromQuery] int? idAgence, [FromQuery] string texte, [FromQuery] string tri) |
|
|
|
|
{ |
|
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(200, default(List<FormationDetailsDTO>)); |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(403, default(ErreurDTO)); |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(404, default(ErreurDTO)); |
|
|
|
|
string exampleJson = null; |
|
|
|
|
exampleJson = "[ {\n \"mode\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"dateDebut\" : \"2000-01-23T04:56:07.000+00:00\",\n \"estCertifie\" : true,\n \"id\" : 0,\n \"dateFin\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"intitule\" : \"intitule\",\n \"statut\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n },\n \"nbPartitipants\" : 1\n}, {\n \"mode\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"dateDebut\" : \"2000-01-23T04:56:07.000+00:00\",\n \"estCertifie\" : true,\n \"id\" : 0,\n \"dateFin\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"intitule\" : \"intitule\",\n \"statut\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n },\n \"nbPartitipants\" : 1\n} ]"; |
|
|
|
|
|
|
|
|
|
var example = exampleJson != null |
|
|
|
|
? JsonConvert.DeserializeObject<List<FormationDetailsDTO>>(exampleJson) |
|
|
|
|
: default(List<FormationDetailsDTO>); //TODO: Change the data returned |
|
|
|
|
return new ObjectResult(example); |
|
|
|
|
IEnumerable<FormationDTO> formations = formationService.GetFormationAnnulees(asc, numPage, parPAge, idAgence, texte, tri); |
|
|
|
|
if (formations == null) |
|
|
|
|
{ |
|
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
|
|
{ |
|
|
|
|
Code = "404", |
|
|
|
|
Message = "Aucune formation annulée" |
|
|
|
|
}; |
|
|
|
|
return NotFound(erreur); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return Ok(formations); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// |
|
|
|
|
/// |
|
|
|
|
/// </summary> |
|
|
|
|
/// <remarks>Récupérer une formation par son id</remarks> |
|
|
|
|
/// <param name="idFormation">id formation</param> |
|
|
|
@ -125,33 +140,29 @@ namespace IO.Swagger.Controllers |
|
|
|
|
/// <response code="404">Ressource n'a pas été trouvée</response> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("/api/formations/{idFormation}")] |
|
|
|
|
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
[ValidateModelState] |
|
|
|
|
[SwaggerOperation("GetFormationById")] |
|
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(FormationDTO), description: "OK")] |
|
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
|
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n'a pas été trouvée")] |
|
|
|
|
public virtual IActionResult GetFormationById([FromRoute][Required]long? idFormation) |
|
|
|
|
{ |
|
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(200, default(FormationDTO)); |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(403, default(ErreurDTO)); |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(404, default(ErreurDTO)); |
|
|
|
|
string exampleJson = null; |
|
|
|
|
exampleJson = "{\n \"heure\" : 5,\n \"participantsFormation\" : [ {\n \"date\" : \"2000-01-23T04:56:07.000+00:00\",\n \"idCollaborateur\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"estEvaluee\" : true,\n \"dateCreation\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 2,\n \"formation\" : \"formation\",\n \"collaborateur\" : \"collaborateur\",\n \"statut\" : \"statut\"\n }, {\n \"date\" : \"2000-01-23T04:56:07.000+00:00\",\n \"idCollaborateur\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"estEvaluee\" : true,\n \"dateCreation\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 2,\n \"formation\" : \"formation\",\n \"collaborateur\" : \"collaborateur\",\n \"statut\" : \"statut\"\n } ],\n \"organisme\" : \"organisme\",\n \"origine\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n },\n \"type\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"intitule\" : \"intitule\",\n \"mode\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"jour\" : 5,\n \"dateDebut\" : \"2000-01-23T04:56:07.000+00:00\",\n \"estCertifie\" : true,\n \"id\" : 0,\n \"dateFin\" : \"2000-01-23T04:56:07.000+00:00\",\n \"idAgence\" : 1,\n \"statut\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n }\n}"; |
|
|
|
|
|
|
|
|
|
var example = exampleJson != null |
|
|
|
|
? JsonConvert.DeserializeObject<FormationDTO>(exampleJson) |
|
|
|
|
: default(FormationDTO); //TODO: Change the data returned |
|
|
|
|
return new ObjectResult(example); |
|
|
|
|
public virtual IActionResult GetFormationById([FromRoute][Required] long? idFormation) |
|
|
|
|
{ |
|
|
|
|
FormationDTO formationDTO = formationService.GetFormationById(Convert.ToInt32(idFormation)); |
|
|
|
|
if (formationDTO == null) |
|
|
|
|
{ |
|
|
|
|
ErreurDTO erreurDTO = new ErreurDTO() |
|
|
|
|
{ |
|
|
|
|
Code = "404", |
|
|
|
|
Message = "La formation n'existe pas", |
|
|
|
|
}; |
|
|
|
|
return NotFound(erreurDTO); |
|
|
|
|
} |
|
|
|
|
return Ok(formationDTO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// |
|
|
|
|
/// |
|
|
|
|
/// </summary> |
|
|
|
|
/// <remarks>Récupérer les formations réalisées</remarks> |
|
|
|
|
/// <param name="asc">Préciser si les données sont dans l'ordre (true) ou dans l'ordre inverse (false)</param> |
|
|
|
@ -165,33 +176,32 @@ namespace IO.Swagger.Controllers |
|
|
|
|
/// <response code="404">Ressource n'a pas été trouvée</response> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("/api/formations/realisees")] |
|
|
|
|
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
[ValidateModelState] |
|
|
|
|
[SwaggerOperation("GetFormationRealisee")] |
|
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<FormationDetailsDTO>), description: "OK")] |
|
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
|
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n'a pas été trouvée")] |
|
|
|
|
public virtual IActionResult GetFormationRealisee([FromQuery][Required()]bool? asc, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]long? idAgence, [FromQuery]string texte, [FromQuery]string tri) |
|
|
|
|
{ |
|
|
|
|
public virtual IActionResult GetFormationRealisee([FromQuery][Required()] bool? asc, [FromQuery][Required()] int? numPage, [FromQuery][Required()] int? parPAge, [FromQuery] int? idAgence, [FromQuery] string texte, [FromQuery] string tri) |
|
|
|
|
{ |
|
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(200, default(List<FormationDetailsDTO>)); |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(403, default(ErreurDTO)); |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(404, default(ErreurDTO)); |
|
|
|
|
string exampleJson = null; |
|
|
|
|
exampleJson = "[ {\n \"mode\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"dateDebut\" : \"2000-01-23T04:56:07.000+00:00\",\n \"estCertifie\" : true,\n \"id\" : 0,\n \"dateFin\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"intitule\" : \"intitule\",\n \"statut\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n },\n \"nbPartitipants\" : 1\n}, {\n \"mode\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"dateDebut\" : \"2000-01-23T04:56:07.000+00:00\",\n \"estCertifie\" : true,\n \"id\" : 0,\n \"dateFin\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"intitule\" : \"intitule\",\n \"statut\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n },\n \"nbPartitipants\" : 1\n} ]"; |
|
|
|
|
|
|
|
|
|
var example = exampleJson != null |
|
|
|
|
? JsonConvert.DeserializeObject<List<FormationDetailsDTO>>(exampleJson) |
|
|
|
|
: default(List<FormationDetailsDTO>); //TODO: Change the data returned |
|
|
|
|
return new ObjectResult(example); |
|
|
|
|
IEnumerable<FormationDTO> formations = formationService.GetFormationRealisee(asc, numPage, parPAge, idAgence, texte, tri); |
|
|
|
|
if (formations == null) |
|
|
|
|
{ |
|
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
|
|
{ |
|
|
|
|
Code = "404", |
|
|
|
|
Message = "Aucune formation réalisée" |
|
|
|
|
}; |
|
|
|
|
return NotFound(erreur); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return Ok(formations); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// |
|
|
|
|
/// |
|
|
|
|
/// </summary> |
|
|
|
|
/// <remarks>Récupérer la liste des formations</remarks> |
|
|
|
|
/// <param name="asc">Préciser si les données sont dans l'ordre (true) ou dans l'ordre inverse (false)</param> |
|
|
|
@ -205,87 +215,90 @@ namespace IO.Swagger.Controllers |
|
|
|
|
/// <response code="403">Acces interdit</response> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("/api/formations")] |
|
|
|
|
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
[ValidateModelState] |
|
|
|
|
[SwaggerOperation("GetFormations")] |
|
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<FormationDetailsDTO>), description: "OK")] |
|
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
|
public virtual IActionResult GetFormations([FromQuery][Required()]bool? asc, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]long? idAgence, [FromQuery]int? statutFormation, [FromQuery]string texte, [FromQuery]string tri) |
|
|
|
|
{ |
|
|
|
|
public virtual IActionResult GetFormations([FromQuery][Required()]bool? asc, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]int? idAgence, [FromQuery]int? statutFormation, [FromQuery]string texte, [FromQuery]string tri) |
|
|
|
|
{ |
|
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(200, default(List<FormationDetailsDTO>)); |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(403, default(ErreurDTO)); |
|
|
|
|
string exampleJson = null; |
|
|
|
|
exampleJson = "[ {\n \"mode\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"dateDebut\" : \"2000-01-23T04:56:07.000+00:00\",\n \"estCertifie\" : true,\n \"id\" : 0,\n \"dateFin\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"intitule\" : \"intitule\",\n \"statut\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n },\n \"nbPartitipants\" : 1\n}, {\n \"mode\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"dateDebut\" : \"2000-01-23T04:56:07.000+00:00\",\n \"estCertifie\" : true,\n \"id\" : 0,\n \"dateFin\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"intitule\" : \"intitule\",\n \"statut\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n },\n \"nbPartitipants\" : 1\n} ]"; |
|
|
|
|
|
|
|
|
|
var example = exampleJson != null |
|
|
|
|
? JsonConvert.DeserializeObject<List<FormationDetailsDTO>>(exampleJson) |
|
|
|
|
: default(List<FormationDetailsDTO>); //TODO: Change the data returned |
|
|
|
|
return new ObjectResult(example); |
|
|
|
|
IEnumerable<FormationDTO> formations = formationService.GetFormations(asc, numPage, parPAge, idAgence, texte, tri); |
|
|
|
|
if (formations == null) |
|
|
|
|
{ |
|
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
|
|
{ |
|
|
|
|
Code = "404", |
|
|
|
|
Message = "Aucune formation" |
|
|
|
|
}; |
|
|
|
|
return NotFound(erreur); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return Ok(formations); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// |
|
|
|
|
/// |
|
|
|
|
/// </summary> |
|
|
|
|
/// <remarks>Récupérer les modes de formation</remarks> |
|
|
|
|
/// <response code="200">OK</response> |
|
|
|
|
/// <response code="403">Acces interdit</response> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("/api/modesFormation")] |
|
|
|
|
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
[ValidateModelState] |
|
|
|
|
[SwaggerOperation("GetModesFormation")] |
|
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<ModeFormationDTO>), description: "OK")] |
|
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
|
public virtual IActionResult GetModesFormation() |
|
|
|
|
{ |
|
|
|
|
{ |
|
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(200, default(List<ModeFormationDTO>)); |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(403, default(ErreurDTO)); |
|
|
|
|
string exampleJson = null; |
|
|
|
|
exampleJson = "[ {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n}, {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n} ]"; |
|
|
|
|
|
|
|
|
|
var example = exampleJson != null |
|
|
|
|
? JsonConvert.DeserializeObject<List<ModeFormationDTO>>(exampleJson) |
|
|
|
|
: default(List<ModeFormationDTO>); //TODO: Change the data returned |
|
|
|
|
return new ObjectResult(example); |
|
|
|
|
IEnumerable<ModeFormationDTO> modeFormations = formationService.GetModesFormation(); |
|
|
|
|
if (modeFormations == null) |
|
|
|
|
{ |
|
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
|
|
{ |
|
|
|
|
Code = "404", |
|
|
|
|
Message = "Aucun mode de formation" |
|
|
|
|
}; |
|
|
|
|
return NotFound(erreur); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return Ok(modeFormations); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// |
|
|
|
|
/// |
|
|
|
|
/// </summary> |
|
|
|
|
/// <remarks>Récupérer les origines de formation</remarks> |
|
|
|
|
/// <response code="200">OK</response> |
|
|
|
|
/// <response code="403">Acces interdit</response> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("/api/originesFormation")] |
|
|
|
|
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
[ValidateModelState] |
|
|
|
|
[SwaggerOperation("GetOriginesFormation")] |
|
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<OrigineFormationDTO>), description: "OK")] |
|
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
|
public virtual IActionResult GetOriginesFormation() |
|
|
|
|
{ |
|
|
|
|
{ |
|
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(200, default(List<OrigineFormationDTO>)); |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(403, default(ErreurDTO)); |
|
|
|
|
string exampleJson = null; |
|
|
|
|
exampleJson = "[ {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n}, {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n} ]"; |
|
|
|
|
|
|
|
|
|
var example = exampleJson != null |
|
|
|
|
? JsonConvert.DeserializeObject<List<OrigineFormationDTO>>(exampleJson) |
|
|
|
|
: default(List<OrigineFormationDTO>); //TODO: Change the data returned |
|
|
|
|
return new ObjectResult(example); |
|
|
|
|
IEnumerable<OrigineFormationDTO> origineFormations = formationService.GetOriginesFormation(); |
|
|
|
|
if (origineFormations == null) |
|
|
|
|
{ |
|
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
|
|
{ |
|
|
|
|
Code = "404", |
|
|
|
|
Message = "Aucune origine de formation" |
|
|
|
|
}; |
|
|
|
|
return NotFound(erreur); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return Ok(origineFormations); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// |
|
|
|
|
/// |
|
|
|
|
/// </summary> |
|
|
|
|
/// <remarks>Récupérer les formations plannifié et replannifié</remarks> |
|
|
|
|
/// <param name="asc">Préciser si les données sont dans l'ordre (true) ou dans l'ordre inverse (false)</param> |
|
|
|
@ -299,91 +312,91 @@ namespace IO.Swagger.Controllers |
|
|
|
|
/// <response code="404">Ressource n'a pas été trouvée</response> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("/api/formations/prochaines")] |
|
|
|
|
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
[ValidateModelState] |
|
|
|
|
[SwaggerOperation("GetProchainesFormation")] |
|
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<FormationDetailsDTO>), description: "OK")] |
|
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
|
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n'a pas été trouvée")] |
|
|
|
|
public virtual IActionResult GetProchainesFormation([FromQuery][Required()]bool? asc, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]long? idAgence, [FromQuery]string texte, [FromQuery]string tri) |
|
|
|
|
{ |
|
|
|
|
public virtual IActionResult GetProchainesFormation([FromQuery][Required()] bool? asc, [FromQuery][Required()] int? numPage, [FromQuery][Required()] int? parPAge, [FromQuery] int? idAgence, [FromQuery] string texte, [FromQuery] string tri) |
|
|
|
|
{ |
|
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(200, default(List<FormationDetailsDTO>)); |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(403, default(ErreurDTO)); |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(404, default(ErreurDTO)); |
|
|
|
|
string exampleJson = null; |
|
|
|
|
exampleJson = "[ {\n \"mode\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"dateDebut\" : \"2000-01-23T04:56:07.000+00:00\",\n \"estCertifie\" : true,\n \"id\" : 0,\n \"dateFin\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"intitule\" : \"intitule\",\n \"statut\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n },\n \"nbPartitipants\" : 1\n}, {\n \"mode\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"dateDebut\" : \"2000-01-23T04:56:07.000+00:00\",\n \"estCertifie\" : true,\n \"id\" : 0,\n \"dateFin\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"intitule\" : \"intitule\",\n \"statut\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n },\n \"nbPartitipants\" : 1\n} ]"; |
|
|
|
|
|
|
|
|
|
var example = exampleJson != null |
|
|
|
|
? JsonConvert.DeserializeObject<List<FormationDetailsDTO>>(exampleJson) |
|
|
|
|
: default(List<FormationDetailsDTO>); //TODO: Change the data returned |
|
|
|
|
return new ObjectResult(example); |
|
|
|
|
IEnumerable<FormationDTO> formations = formationService.GetProchainesFormation(asc, numPage, parPAge, idAgence, texte, tri); |
|
|
|
|
if (formations == null) |
|
|
|
|
{ |
|
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
|
|
{ |
|
|
|
|
Code = "404", |
|
|
|
|
Message = "Aucune prochaine formation" |
|
|
|
|
}; |
|
|
|
|
return NotFound(erreur); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return Ok(formations); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// |
|
|
|
|
/// |
|
|
|
|
/// </summary> |
|
|
|
|
/// <remarks>Récupérer les statuts de formation</remarks> |
|
|
|
|
/// <response code="200">OK</response> |
|
|
|
|
/// <response code="403">Acces interdit</response> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("/api/statutsFormation")] |
|
|
|
|
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
[ValidateModelState] |
|
|
|
|
[SwaggerOperation("GetStatutsFormation")] |
|
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<StatutFormationDTO>), description: "OK")] |
|
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
|
public virtual IActionResult GetStatutsFormation() |
|
|
|
|
{ |
|
|
|
|
{ |
|
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(200, default(List<StatutFormationDTO>)); |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(403, default(ErreurDTO)); |
|
|
|
|
string exampleJson = null; |
|
|
|
|
exampleJson = "[ {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n}, {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n} ]"; |
|
|
|
|
|
|
|
|
|
var example = exampleJson != null |
|
|
|
|
? JsonConvert.DeserializeObject<List<StatutFormationDTO>>(exampleJson) |
|
|
|
|
: default(List<StatutFormationDTO>); //TODO: Change the data returned |
|
|
|
|
return new ObjectResult(example); |
|
|
|
|
IEnumerable<StatutFormationDTO> statutFormations = formationService.GetStatutsFormation(); |
|
|
|
|
if (statutFormations == null) |
|
|
|
|
{ |
|
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
|
|
{ |
|
|
|
|
Code = "404", |
|
|
|
|
Message = "Aucun statut de formation" |
|
|
|
|
}; |
|
|
|
|
return NotFound(erreur); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return Ok(statutFormations); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// |
|
|
|
|
/// |
|
|
|
|
/// </summary> |
|
|
|
|
/// <remarks>Récupérer les types de formation</remarks> |
|
|
|
|
/// <response code="200">OK</response> |
|
|
|
|
/// <response code="403">Acces interdit</response> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("/api/typesFormation")] |
|
|
|
|
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
[ValidateModelState] |
|
|
|
|
[SwaggerOperation("GetTypesFormation")] |
|
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<TypeFormationDTO>), description: "OK")] |
|
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
|
public virtual IActionResult GetTypesFormation() |
|
|
|
|
{ |
|
|
|
|
{ |
|
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(200, default(List<TypeFormationDTO>)); |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(403, default(ErreurDTO)); |
|
|
|
|
string exampleJson = null; |
|
|
|
|
exampleJson = "[ {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n}, {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n} ]"; |
|
|
|
|
|
|
|
|
|
var example = exampleJson != null |
|
|
|
|
? JsonConvert.DeserializeObject<List<TypeFormationDTO>>(exampleJson) |
|
|
|
|
: default(List<TypeFormationDTO>); //TODO: Change the data returned |
|
|
|
|
return new ObjectResult(example); |
|
|
|
|
IEnumerable<TypeFormationDTO> typeFormations = formationService.GetTypesFormation(); |
|
|
|
|
if (typeFormations == null) |
|
|
|
|
{ |
|
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
|
|
{ |
|
|
|
|
Code = "404", |
|
|
|
|
Message = "Aucun type de formation" |
|
|
|
|
}; |
|
|
|
|
return NotFound(erreur); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return Ok(typeFormations); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// |
|
|
|
|
/// |
|
|
|
|
/// </summary> |
|
|
|
|
/// <remarks>Mettre à jour une formation</remarks> |
|
|
|
|
/// <param name="body"></param> |
|
|
|
@ -393,22 +406,33 @@ namespace IO.Swagger.Controllers |
|
|
|
|
/// <response code="403">Acces interdit</response> |
|
|
|
|
[HttpPut] |
|
|
|
|
[Route("/api/formations/{idFormation}/update")] |
|
|
|
|
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
[ValidateModelState] |
|
|
|
|
[SwaggerOperation("UpdateFormation")] |
|
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
|
public virtual IActionResult UpdateFormation([FromBody]FormationDTO body, [FromRoute][Required]long? idFormation) |
|
|
|
|
{ |
|
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(200); |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 201 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(201); |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(403, default(ErreurDTO)); |
|
|
|
|
public virtual IActionResult UpdateFormation([FromBody] FormationDTO body, [FromRoute][Required] long? idFormation) |
|
|
|
|
{ |
|
|
|
|
FormationDTO formation = formationService.UpdateFormation(body); |
|
|
|
|
if (formation == null) |
|
|
|
|
{ |
|
|
|
|
formation = formationService.AddFormation(body); |
|
|
|
|
return Created("", formation); |
|
|
|
|
} |
|
|
|
|
return Ok(formation); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//switch (formationService.UpdateFormation(body)) |
|
|
|
|
//{ |
|
|
|
|
// case 0: |
|
|
|
|
// return Ok(); |
|
|
|
|
// case 1: |
|
|
|
|
// return StatusCode(201); |
|
|
|
|
// case 2: |
|
|
|
|
// return Forbid(); |
|
|
|
|
// default: |
|
|
|
|
// return NotFound(); |
|
|
|
|
//} |
|
|
|
|
|
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|