|
|
|
/*
|
|
|
|
* API du serveur de l'application de digitalisation des EP
|
|
|
|
*
|
|
|
|
* 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;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Swashbuckle.AspNetCore.Annotations;
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
using IO.Swagger.Attributes;
|
|
|
|
using IO.Swagger.DTO;
|
|
|
|
using EPAServeur.IServices;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
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>
|
|
|
|
/// <response code="201">Formation créée avec succès</response>
|
|
|
|
/// <response code="403">Acces interdit</response>
|
|
|
|
[HttpPost]
|
|
|
|
[Route("/api/formations")]
|
|
|
|
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
|
|
|
|
[ValidateModelState]
|
|
|
|
[SwaggerOperation("AjouterFormation")]
|
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
|
|
|
|
public virtual async Task<IActionResult> AjouterFormation([FromBody] FormationDTO body)
|
|
|
|
{
|
|
|
|
FormationDTO nouvelleFormation = await formationService.AddFormationAsync(body);
|
|
|
|
|
|
|
|
return Created("", nouvelleFormation);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>Supprimer une formation</remarks>
|
|
|
|
/// <param name="idFormation">id formation</param>
|
|
|
|
/// <response code="204">Formation supprimée avec succès</response>
|
|
|
|
/// <response code="403">Acces interdit</response>
|
|
|
|
[HttpDelete]
|
|
|
|
[Route("/api/formations/{idFormation}/supprimer")]
|
|
|
|
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
|
|
|
|
[ValidateModelState]
|
|
|
|
[SwaggerOperation("DeleteFormation")]
|
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
|
|
|
|
public virtual async Task<IActionResult> DeleteFormation([FromRoute][Required] long? idFormation)
|
|
|
|
{
|
|
|
|
if ( ! await formationService.DeleteFormationByIdAsync(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>
|
|
|
|
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param>
|
|
|
|
/// <param name="parPAge">Nombre d'éléments affiché sur chaque page du tableau</param>
|
|
|
|
/// <param name="idAgence">id de l'agence à laquelle sont rattachées les données à récupérer</param>
|
|
|
|
/// <param name="texte">Texte permettant d'identifier l'objet rechercher</param>
|
|
|
|
/// <param name="tri">Colonne du tableau sur lequel le tri s'effectue</param>
|
|
|
|
/// <response code="200">OK</response>
|
|
|
|
/// <response code="403">Acces interdit</response>
|
|
|
|
/// <response code="404">Ressource n'a pas été trouvée</response>
|
|
|
|
[HttpGet]
|
|
|
|
[Route("/api/formations/annulees")]
|
|
|
|
//[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 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(..), ...
|
|
|
|
IEnumerable<FormationDTO> formations = await formationService.GetFormationAnnuleesAsync(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>
|
|
|
|
/// <response code="200">OK</response>
|
|
|
|
/// <response code="403">Acces interdit</response>
|
|
|
|
/// <response code="404">Ressource n'a pas été trouvée</response>
|
|
|
|
[HttpGet]
|
|
|
|
[Route("/api/formations/{idFormation}")]
|
|
|
|
//[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 async Task<IActionResult> GetFormationById([FromRoute][Required] long? idFormation)
|
|
|
|
{
|
|
|
|
FormationDTO formationDTO = await formationService.GetFormationByIdAsync(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>
|
|
|
|
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param>
|
|
|
|
/// <param name="parPAge">Nombre d'éléments affiché sur chaque page du tableau</param>
|
|
|
|
/// <param name="idAgence">id de l'agence à laquelle sont rattachées les données à récupérer</param>
|
|
|
|
/// <param name="texte">Texte permettant d'identifier l'objet rechercher</param>
|
|
|
|
/// <param name="tri">Colonne du tableau sur lequel le tri s'effectue</param>
|
|
|
|
/// <response code="200">OK</response>
|
|
|
|
/// <response code="403">Acces interdit</response>
|
|
|
|
/// <response code="404">Ressource n'a pas été trouvée</response>
|
|
|
|
[HttpGet]
|
|
|
|
[Route("/api/formations/realisees")]
|
|
|
|
//[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 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(..), ...
|
|
|
|
IEnumerable<FormationDTO> formations = await formationService.GetFormationRealiseeAsync(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>
|
|
|
|
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param>
|
|
|
|
/// <param name="parPAge">Nombre d'éléments affiché sur chaque page du tableau</param>
|
|
|
|
/// <param name="idAgence">id de l'agence à laquelle sont rattachées les données à récupérer</param>
|
|
|
|
/// <param name="statutFormation">Statut de la formation</param>
|
|
|
|
/// <param name="texte">Texte permettant d'identifier l'objet rechercher</param>
|
|
|
|
/// <param name="tri">Colonne du tableau sur lequel le tri s'effectue</param>
|
|
|
|
/// <response code="200">OK</response>
|
|
|
|
/// <response code="403">Acces interdit</response>
|
|
|
|
[HttpGet]
|
|
|
|
[Route("/api/formations")]
|
|
|
|
//[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 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(..), ...
|
|
|
|
IEnumerable<FormationDTO> formations = await formationService.GetFormationsAsync(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)]
|
|
|
|
[ValidateModelState]
|
|
|
|
[SwaggerOperation("GetModesFormation")]
|
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<ModeFormationDTO>), description: "OK")]
|
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
|
|
|
|
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(..), ...
|
|
|
|
IEnumerable<ModeFormationDTO> modeFormations = await formationService.GetModesFormationAsync();
|
|
|
|
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)]
|
|
|
|
[ValidateModelState]
|
|
|
|
[SwaggerOperation("GetOriginesFormation")]
|
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<OrigineFormationDTO>), description: "OK")]
|
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
|
|
|
|
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(..), ...
|
|
|
|
IEnumerable<OrigineFormationDTO> origineFormations = await formationService.GetOriginesFormationAsync();
|
|
|
|
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>
|
|
|
|
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param>
|
|
|
|
/// <param name="parPAge">Nombre d'éléments affiché sur chaque page du tableau</param>
|
|
|
|
/// <param name="idAgence">id de l'agence à laquelle sont rattachées les données à récupérer</param>
|
|
|
|
/// <param name="texte">Texte permettant d'identifier l'objet rechercher</param>
|
|
|
|
/// <param name="tri">Colonne du tableau sur lequel le tri s'effectue</param>
|
|
|
|
/// <response code="200">OK</response>
|
|
|
|
/// <response code="403">Acces interdit</response>
|
|
|
|
/// <response code="404">Ressource n'a pas été trouvée</response>
|
|
|
|
[HttpGet]
|
|
|
|
[Route("/api/formations/prochaines")]
|
|
|
|
//[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 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(..), ...
|
|
|
|
IEnumerable<FormationDTO> formations = await formationService.GetProchainesFormationAsync(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)]
|
|
|
|
[ValidateModelState]
|
|
|
|
[SwaggerOperation("GetStatutsFormation")]
|
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<StatutFormationDTO>), description: "OK")]
|
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
|
|
|
|
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(..), ...
|
|
|
|
IEnumerable<StatutFormationDTO> statutFormations = await formationService.GetStatutsFormationAsync();
|
|
|
|
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)]
|
|
|
|
[ValidateModelState]
|
|
|
|
[SwaggerOperation("GetTypesFormation")]
|
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<TypeFormationDTO>), description: "OK")]
|
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
|
|
|
|
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(..), ...
|
|
|
|
IEnumerable<TypeFormationDTO> typeFormations = await formationService.GetTypesFormationAsync();
|
|
|
|
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>
|
|
|
|
/// <param name="idFormation">id formation</param>
|
|
|
|
/// <response code="200">formation mise à jour</response>
|
|
|
|
/// <response code="201">Formation créée avec succès</response>
|
|
|
|
/// <response code="403">Acces interdit</response>
|
|
|
|
[HttpPut]
|
|
|
|
[Route("/api/formations/{idFormation}/update")]
|
|
|
|
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
|
|
|
|
[ValidateModelState]
|
|
|
|
[SwaggerOperation("UpdateFormation")]
|
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
|
|
|
|
public virtual async Task<IActionResult> UpdateFormation([FromBody] FormationDTO body, [FromRoute][Required] long? idFormation)
|
|
|
|
{
|
|
|
|
FormationDTO formation = await formationService.UpdateFormationAsync(idFormation, body);
|
|
|
|
if (formation == null)
|
|
|
|
{
|
|
|
|
formation = formationService.AddFormation(body);
|
|
|
|
return Created("", formation);
|
|
|
|
}
|
|
|
|
return Ok(formation);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|