|
|
@ -17,6 +17,7 @@ using IO.Swagger.Attributes; |
|
|
|
using IO.Swagger.DTO; |
|
|
|
using IO.Swagger.DTO; |
|
|
|
using EPAServeur.IServices; |
|
|
|
using EPAServeur.IServices; |
|
|
|
using System.Linq; |
|
|
|
using System.Linq; |
|
|
|
|
|
|
|
using System.Threading.Tasks; |
|
|
|
|
|
|
|
|
|
|
|
namespace IO.Swagger.Controllers |
|
|
|
namespace IO.Swagger.Controllers |
|
|
|
{ |
|
|
|
{ |
|
|
@ -46,9 +47,9 @@ namespace IO.Swagger.Controllers |
|
|
|
[ValidateModelState] |
|
|
|
[ValidateModelState] |
|
|
|
[SwaggerOperation("AjouterFormation")] |
|
|
|
[SwaggerOperation("AjouterFormation")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
public virtual IActionResult AjouterFormation([FromBody] FormationDTO body) |
|
|
|
public virtual async Task<IActionResult> AjouterFormation([FromBody] FormationDTO body) |
|
|
|
{ |
|
|
|
{ |
|
|
|
FormationDTO nouvelleFormation = formationService.AddFormation(body); |
|
|
|
FormationDTO nouvelleFormation = await formationService.AddFormationAsync(body); |
|
|
|
|
|
|
|
|
|
|
|
return Created("", nouvelleFormation); |
|
|
|
return Created("", nouvelleFormation); |
|
|
|
} |
|
|
|
} |
|
|
@ -66,9 +67,9 @@ namespace IO.Swagger.Controllers |
|
|
|
[ValidateModelState] |
|
|
|
[ValidateModelState] |
|
|
|
[SwaggerOperation("DeleteFormation")] |
|
|
|
[SwaggerOperation("DeleteFormation")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
public virtual IActionResult DeleteFormation([FromRoute][Required] long? idFormation) |
|
|
|
public virtual async Task<IActionResult> DeleteFormation([FromRoute][Required] long? idFormation) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!formationService.DeleteFormationById(idFormation)) |
|
|
|
if ( ! await formationService.DeleteFormationByIdAsync(idFormation)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -102,10 +103,10 @@ namespace IO.Swagger.Controllers |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<FormationDetailsDTO>), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<FormationDetailsDTO>), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n'a pas été trouvée")] |
|
|
|
[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) |
|
|
|
public virtual async Task<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(..), ... |
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
IEnumerable<FormationDTO> formations = formationService.GetFormationAnnulees(asc, numPage, parPAge, idAgence, texte, tri); |
|
|
|
IEnumerable<FormationDTO> formations = await formationService.GetFormationAnnuleesAsync(asc, numPage, parPAge, idAgence, texte, tri); |
|
|
|
if (formations == null) |
|
|
|
if (formations == null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
@ -135,9 +136,9 @@ namespace IO.Swagger.Controllers |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(FormationDTO), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(FormationDTO), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n'a pas été trouvée")] |
|
|
|
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n'a pas été trouvée")] |
|
|
|
public virtual IActionResult GetFormationById([FromRoute][Required] long? idFormation) |
|
|
|
public virtual async Task<IActionResult> GetFormationById([FromRoute][Required] long? idFormation) |
|
|
|
{ |
|
|
|
{ |
|
|
|
FormationDTO formationDTO = formationService.GetFormationById(Convert.ToInt32(idFormation)); |
|
|
|
FormationDTO formationDTO = await formationService.GetFormationByIdAsync(idFormation); |
|
|
|
if (formationDTO == null) |
|
|
|
if (formationDTO == null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ErreurDTO erreurDTO = new ErreurDTO() |
|
|
|
ErreurDTO erreurDTO = new ErreurDTO() |
|
|
@ -171,10 +172,10 @@ namespace IO.Swagger.Controllers |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<FormationDetailsDTO>), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<FormationDetailsDTO>), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n'a pas été trouvée")] |
|
|
|
[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) |
|
|
|
public virtual async Task<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(..), ... |
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
IEnumerable<FormationDTO> formations = formationService.GetFormationRealisee(asc, numPage, parPAge, idAgence, texte, tri); |
|
|
|
IEnumerable<FormationDTO> formations = await formationService.GetFormationRealiseeAsync(asc, numPage, parPAge, idAgence, texte, tri); |
|
|
|
if (formations == null) |
|
|
|
if (formations == null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
@ -209,10 +210,10 @@ namespace IO.Swagger.Controllers |
|
|
|
[SwaggerOperation("GetFormations")] |
|
|
|
[SwaggerOperation("GetFormations")] |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<FormationDetailsDTO>), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<FormationDetailsDTO>), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
[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 async Task<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(..), ... |
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
IEnumerable<FormationDTO> formations = formationService.GetFormations(asc, numPage, parPAge, idAgence, texte, tri); |
|
|
|
IEnumerable<FormationDTO> formations = await formationService.GetFormationsAsync(asc, numPage, parPAge, idAgence, texte, tri); |
|
|
|
if (formations == null) |
|
|
|
if (formations == null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
@ -239,10 +240,10 @@ namespace IO.Swagger.Controllers |
|
|
|
[SwaggerOperation("GetModesFormation")] |
|
|
|
[SwaggerOperation("GetModesFormation")] |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<ModeFormationDTO>), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<ModeFormationDTO>), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
public virtual IActionResult GetModesFormation() |
|
|
|
public virtual async Task<IActionResult> GetModesFormation() |
|
|
|
{ |
|
|
|
{ |
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
IEnumerable<ModeFormationDTO> modeFormations = formationService.GetModesFormation(); |
|
|
|
IEnumerable<ModeFormationDTO> modeFormations = await formationService.GetModesFormationAsync(); |
|
|
|
if (modeFormations == null) |
|
|
|
if (modeFormations == null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
@ -269,10 +270,10 @@ namespace IO.Swagger.Controllers |
|
|
|
[SwaggerOperation("GetOriginesFormation")] |
|
|
|
[SwaggerOperation("GetOriginesFormation")] |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<OrigineFormationDTO>), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<OrigineFormationDTO>), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
public virtual IActionResult GetOriginesFormation() |
|
|
|
public virtual async Task<IActionResult> GetOriginesFormation() |
|
|
|
{ |
|
|
|
{ |
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
IEnumerable<OrigineFormationDTO> origineFormations = formationService.GetOriginesFormation(); |
|
|
|
IEnumerable<OrigineFormationDTO> origineFormations = await formationService.GetOriginesFormationAsync(); |
|
|
|
if (origineFormations == null) |
|
|
|
if (origineFormations == null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
@ -307,10 +308,10 @@ namespace IO.Swagger.Controllers |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<FormationDetailsDTO>), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<FormationDetailsDTO>), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n'a pas été trouvée")] |
|
|
|
[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] int? idAgence, [FromQuery] string texte, [FromQuery] string tri) |
|
|
|
public virtual async Task<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(..), ... |
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
IEnumerable<FormationDTO> formations = formationService.GetProchainesFormation(asc, numPage, parPAge, idAgence, texte, tri); |
|
|
|
IEnumerable<FormationDTO> formations = await formationService.GetProchainesFormationAsync(asc, numPage, parPAge, idAgence, texte, tri); |
|
|
|
if (formations == null) |
|
|
|
if (formations == null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
@ -337,10 +338,10 @@ namespace IO.Swagger.Controllers |
|
|
|
[SwaggerOperation("GetStatutsFormation")] |
|
|
|
[SwaggerOperation("GetStatutsFormation")] |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<StatutFormationDTO>), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<StatutFormationDTO>), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
public virtual IActionResult GetStatutsFormation() |
|
|
|
public virtual async Task<IActionResult> GetStatutsFormation() |
|
|
|
{ |
|
|
|
{ |
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
IEnumerable<StatutFormationDTO> statutFormations = formationService.GetStatutsFormation(); |
|
|
|
IEnumerable<StatutFormationDTO> statutFormations = await formationService.GetStatutsFormationAsync(); |
|
|
|
if (statutFormations == null) |
|
|
|
if (statutFormations == null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
@ -367,10 +368,10 @@ namespace IO.Swagger.Controllers |
|
|
|
[SwaggerOperation("GetTypesFormation")] |
|
|
|
[SwaggerOperation("GetTypesFormation")] |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<TypeFormationDTO>), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<TypeFormationDTO>), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
public virtual IActionResult GetTypesFormation() |
|
|
|
public virtual async Task<IActionResult> GetTypesFormation() |
|
|
|
{ |
|
|
|
{ |
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
IEnumerable<TypeFormationDTO> typeFormations = formationService.GetTypesFormation(); |
|
|
|
IEnumerable<TypeFormationDTO> typeFormations = await formationService.GetTypesFormationAsync(); |
|
|
|
if (typeFormations == null) |
|
|
|
if (typeFormations == null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
|
ErreurDTO erreur = new ErreurDTO() |
|
|
@ -399,29 +400,15 @@ namespace IO.Swagger.Controllers |
|
|
|
[ValidateModelState] |
|
|
|
[ValidateModelState] |
|
|
|
[SwaggerOperation("UpdateFormation")] |
|
|
|
[SwaggerOperation("UpdateFormation")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
public virtual IActionResult UpdateFormation([FromBody] FormationDTO body, [FromRoute][Required] long? idFormation) |
|
|
|
public virtual async Task<IActionResult> UpdateFormation([FromBody] FormationDTO body, [FromRoute][Required] long? idFormation) |
|
|
|
{ |
|
|
|
{ |
|
|
|
FormationDTO formation = formationService.UpdateFormation(idFormation, body); |
|
|
|
FormationDTO formation = await formationService.UpdateFormationAsync(idFormation, body); |
|
|
|
if (formation == null) |
|
|
|
if (formation == null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
formation = formationService.AddFormation(body); |
|
|
|
formation = formationService.AddFormation(body); |
|
|
|
return Created("", formation); |
|
|
|
return Created("", formation); |
|
|
|
} |
|
|
|
} |
|
|
|
return Ok(formation); |
|
|
|
return Ok(formation); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//switch (formationService.UpdateFormation(body)) |
|
|
|
|
|
|
|
//{ |
|
|
|
|
|
|
|
// case 0: |
|
|
|
|
|
|
|
// return Ok(); |
|
|
|
|
|
|
|
// case 1: |
|
|
|
|
|
|
|
// return StatusCode(201); |
|
|
|
|
|
|
|
// case 2: |
|
|
|
|
|
|
|
// return Forbid(); |
|
|
|
|
|
|
|
// default: |
|
|
|
|
|
|
|
// return NotFound(); |
|
|
|
|
|
|
|
//} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|