|
|
|
@ -18,6 +18,7 @@ using IO.Swagger.Attributes; |
|
|
|
|
using IO.Swagger.Security; |
|
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
|
using IO.Swagger.DTO; |
|
|
|
|
using EPAServeur.IServices; |
|
|
|
|
|
|
|
|
|
namespace IO.Swagger.Controllers |
|
|
|
|
{ |
|
|
|
@ -26,7 +27,14 @@ namespace IO.Swagger.Controllers |
|
|
|
|
/// </summary> |
|
|
|
|
[ApiController] |
|
|
|
|
public class FormationsApiController : ControllerBase |
|
|
|
|
{ |
|
|
|
|
{ |
|
|
|
|
private readonly IFormationService formationService; |
|
|
|
|
|
|
|
|
|
public FormationsApiController(IFormationService _formationService) |
|
|
|
|
{ |
|
|
|
|
formationService = _formationService; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// |
|
|
|
|
/// </summary> |
|
|
|
@ -36,19 +44,21 @@ 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(); |
|
|
|
|
{ |
|
|
|
|
switch (formationService.AddFormation(body)) |
|
|
|
|
{ |
|
|
|
|
case 0: |
|
|
|
|
return StatusCode(201); |
|
|
|
|
case 1: |
|
|
|
|
return Forbid(); |
|
|
|
|
default: |
|
|
|
|
return NotFound(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
@ -60,19 +70,37 @@ 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]decimal? 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(); |
|
|
|
|
{ |
|
|
|
|
int id = 0; |
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
id = Convert.ToInt32(idFormation); |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
ErreurDTO erreurDTO = new ErreurDTO() |
|
|
|
|
{ |
|
|
|
|
Code = "403", |
|
|
|
|
Message = "Impossible de convertir le paramètre idFormation en int. " + ex.Message |
|
|
|
|
}; |
|
|
|
|
return StatusCode(403, erreurDTO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switch (formationService.DeleteFormationById(id)) |
|
|
|
|
{ |
|
|
|
|
case 0: |
|
|
|
|
return NoContent(); |
|
|
|
|
case 1: |
|
|
|
|
return Forbid(); |
|
|
|
|
default: |
|
|
|
|
return NotFound(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
@ -90,29 +118,29 @@ 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]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>)); |
|
|
|
|
return StatusCode(200, formationService.GetFormationAnnulees()); |
|
|
|
|
|
|
|
|
|
//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); |
|
|
|
|
//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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
@ -125,29 +153,39 @@ 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]decimal? 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\" : 1.4658129805029452,\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\" : 5,\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\" : 5,\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.962133916683182,\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 \"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); |
|
|
|
|
FormationDTO formationDTO = formationService.GetFormationById(Convert.ToInt32(idFormation)); |
|
|
|
|
if (formationDTO == null) |
|
|
|
|
{ |
|
|
|
|
ErreurDTO erreurDTO = new ErreurDTO() |
|
|
|
|
{ |
|
|
|
|
Code = "404", |
|
|
|
|
Message = "Le formateur n'existe pas", |
|
|
|
|
}; |
|
|
|
|
return NotFound(erreurDTO); |
|
|
|
|
} |
|
|
|
|
return Ok(formationDTO); |
|
|
|
|
|
|
|
|
|
//string exampleJson = null; |
|
|
|
|
//exampleJson = "{\n \"heure\" : 1.4658129805029452,\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\" : 5,\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\" : 5,\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.962133916683182,\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 \"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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
@ -165,29 +203,29 @@ 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]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>)); |
|
|
|
|
return StatusCode(200, formationService.GetFormationRealisee()); |
|
|
|
|
|
|
|
|
|
//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); |
|
|
|
|
//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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
@ -205,25 +243,25 @@ 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]int? 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>)); |
|
|
|
|
return StatusCode(200, formationService.GetFormations()); |
|
|
|
|
|
|
|
|
|
//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} ]"; |
|
|
|
|
//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); |
|
|
|
|
// var example = exampleJson != null |
|
|
|
|
// ? JsonConvert.DeserializeObject<List<FormationDetailsDTO>>(exampleJson) |
|
|
|
|
// : default(List<FormationDetailsDTO>); //TODO: Change the data returned |
|
|
|
|
//return new ObjectResult(example); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
@ -234,25 +272,25 @@ namespace IO.Swagger.Controllers |
|
|
|
|
/// <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>)); |
|
|
|
|
return StatusCode(200, formationService.GetModesFormation()); |
|
|
|
|
|
|
|
|
|
//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); |
|
|
|
|
//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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
@ -263,25 +301,25 @@ namespace IO.Swagger.Controllers |
|
|
|
|
/// <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>)); |
|
|
|
|
return StatusCode(200, formationService.GetOriginesFormation()); |
|
|
|
|
|
|
|
|
|
//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); |
|
|
|
|
//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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
@ -299,7 +337,7 @@ 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")] |
|
|
|
@ -332,25 +370,25 @@ namespace IO.Swagger.Controllers |
|
|
|
|
/// <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>)); |
|
|
|
|
return StatusCode(200, formationService.GetStatutsFormation()); |
|
|
|
|
|
|
|
|
|
//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); |
|
|
|
|
//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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
@ -361,25 +399,25 @@ namespace IO.Swagger.Controllers |
|
|
|
|
/// <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>)); |
|
|
|
|
return StatusCode(200, formationService.GetTypesFormation()); |
|
|
|
|
|
|
|
|
|
//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); |
|
|
|
|
//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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
@ -393,12 +431,12 @@ 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]decimal? 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); |
|
|
|
|
|
|
|
|
@ -407,8 +445,38 @@ namespace IO.Swagger.Controllers |
|
|
|
|
|
|
|
|
|
//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)); |
|
|
|
|
int id = 0; |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
id = Convert.ToInt32(idFormation); |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
ErreurDTO erreurDTO = new ErreurDTO() |
|
|
|
|
{ |
|
|
|
|
Code = "403", |
|
|
|
|
Message = "Impossible de convertir le paramètre idFormation en int. " + ex.Message |
|
|
|
|
}; |
|
|
|
|
return StatusCode(403, erreurDTO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (formationService.DeleteFormationById(id)) |
|
|
|
|
{ |
|
|
|
|
case 0: |
|
|
|
|
return StatusCode(201); |
|
|
|
|
case 1: |
|
|
|
|
return StatusCode(200); |
|
|
|
|
case 2: |
|
|
|
|
return StatusCode(403); |
|
|
|
|
default: |
|
|
|
|
return NotFound(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//TODO: Uncomment the next line to return response 201 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
formationService.UpdateFormation(body); |
|
|
|
|
return StatusCode(201); |
|
|
|
|
|
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|