|
|
@ -20,6 +20,7 @@ using System.Net; |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using IO.Swagger.Security; |
|
|
|
using IO.Swagger.Security; |
|
|
|
using System.Linq; |
|
|
|
using System.Linq; |
|
|
|
|
|
|
|
using System.Threading.Tasks; |
|
|
|
|
|
|
|
|
|
|
|
namespace IO.Swagger.Controllers |
|
|
|
namespace IO.Swagger.Controllers |
|
|
|
{ |
|
|
|
{ |
|
|
@ -52,9 +53,9 @@ namespace IO.Swagger.Controllers |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(ReferentDTO), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(ReferentDTO), 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 GetReferentById([FromRoute][Required]Guid? idReferent) |
|
|
|
public virtual async Task<IActionResult> GetReferentById([FromRoute][Required]Guid? idReferent) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ReferentDTO referentDTO = referentService.GetReferentById(idReferent); |
|
|
|
ReferentDTO referentDTO = await referentService.GetReferentByIdAsync(idReferent); |
|
|
|
if (referentDTO == null) |
|
|
|
if (referentDTO == null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ErreurDTO erreurDTO = new ErreurDTO() |
|
|
|
ErreurDTO erreurDTO = new ErreurDTO() |
|
|
@ -89,19 +90,9 @@ namespace IO.Swagger.Controllers |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<ReferentDTO>), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<ReferentDTO>), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")] |
|
|
|
public virtual IActionResult GetReferents([FromQuery][Required()]bool? asc, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]List<string> fonctions, [FromQuery]long? idAgence, [FromQuery]long? idBU, [FromQuery]string texte, [FromQuery]string tri) |
|
|
|
public virtual IActionResult GetReferents([FromQuery][Required()]bool? asc, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]List<string> fonctions, [FromQuery]long? idAgence, [FromQuery]long? idBU, [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<ReferentDTO> referentDTOs = referentService.GetReferents(asc,numPage,parPAge,fonctions,idAgence,idBU,texte,tri); |
|
|
|
// return StatusCode(200, default(List<ReferentDTO>)); |
|
|
|
return Ok(); |
|
|
|
|
|
|
|
|
|
|
|
//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 \"mailApside\" : \"\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\",\n \"collaborateurs\" : [ null, null ]\n}, {\n \"mailApside\" : \"\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\",\n \"collaborateurs\" : [ null, null ]\n} ]"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var example = exampleJson != null |
|
|
|
|
|
|
|
? JsonConvert.DeserializeObject<List<ReferentDTO>>(exampleJson) |
|
|
|
|
|
|
|
: default(List<ReferentDTO>); //TODO: Change the data returned |
|
|
|
|
|
|
|
return new ObjectResult(example); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
@ -120,9 +111,9 @@ namespace IO.Swagger.Controllers |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(ReferentDTO), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(ReferentDTO), 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 GetReferentActuelCollaborateur([FromRoute][Required] Guid? idCollaborateur) |
|
|
|
public virtual async Task<IActionResult> GetReferentActuelCollaborateur([FromRoute][Required] Guid? idCollaborateur) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ReferentDTO referentDTO = referentService.GetReferentActuelCollaborateur(idCollaborateur); |
|
|
|
ReferentDTO referentDTO = await referentService.GetReferentActuelCollaborateurAsync(idCollaborateur); |
|
|
|
if (referentDTO == null) |
|
|
|
if (referentDTO == null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ErreurDTO erreurDTO = new ErreurDTO() |
|
|
|
ErreurDTO erreurDTO = new ErreurDTO() |
|
|
@ -156,9 +147,9 @@ namespace IO.Swagger.Controllers |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<ReferentDTO>), description: "OK")] |
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<ReferentDTO>), 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 GetReferentsByCollaborateur([FromQuery][Required()] bool? asc, [FromRoute][Required] Guid? idCollaborateur, [FromQuery][Required()] int? numPage, [FromQuery][Required()] int? parPAge, [FromQuery] string texte, [FromQuery] string tri) |
|
|
|
public virtual async Task<IActionResult> GetReferentsByCollaborateur([FromQuery][Required()] bool? asc, [FromRoute][Required] Guid? idCollaborateur, [FromQuery][Required()] int? numPage, [FromQuery][Required()] int? parPAge, [FromQuery] string texte, [FromQuery] string tri) |
|
|
|
{ |
|
|
|
{ |
|
|
|
IEnumerable<ReferentDTO> referentDTO = referentService.GetReferentsByCollaborateur(asc,idCollaborateur,numPage,parPAge,texte,tri); |
|
|
|
IEnumerable<ReferentDTO> referentDTO = await referentService.GetReferentsByCollaborateurAsync(asc,idCollaborateur,numPage,parPAge,texte,tri); |
|
|
|
if (referentDTO.Count() == 0) |
|
|
|
if (referentDTO.Count() == 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ErreurDTO erreurDTO = new ErreurDTO() |
|
|
|
ErreurDTO erreurDTO = new ErreurDTO() |
|
|
|