Modification des controles des listes nulles dans l'api formation

develop
jboinembalome 4 years ago
parent f60c4ddb83
commit b0f6787f29
  1. 31
      Controllers/FormationsApi.cs

@ -11,16 +11,12 @@ using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Swashbuckle.AspNetCore.SwaggerGen;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
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;
using System.Linq;
namespace IO.Swagger.Controllers
{
@ -55,14 +51,6 @@ namespace IO.Swagger.Controllers
FormationDTO nouvelleFormation = formationService.AddFormation(body);
return Created("", nouvelleFormation);
//if (body.Id != null && body.Id > 0)
//{
// return StatusCode(201, body);
//}
//else
//{
// return NotFound();
//}
}
/// <summary>
@ -89,6 +77,7 @@ namespace IO.Swagger.Controllers
};
return NotFound(erreur);
}
return NoContent();
}
@ -117,7 +106,7 @@ namespace IO.Swagger.Controllers
{
//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);
if (formations == null)
if (formations.Count() == 0)
{
ErreurDTO erreur = new ErreurDTO()
{
@ -186,7 +175,7 @@ namespace IO.Swagger.Controllers
{
//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);
if (formations == null)
if (formations.Count() == 0)
{
ErreurDTO erreur = new ErreurDTO()
{
@ -224,7 +213,7 @@ namespace IO.Swagger.Controllers
{
//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);
if (formations == null)
if (formations.Count() == 0)
{
ErreurDTO erreur = new ErreurDTO()
{
@ -254,7 +243,7 @@ namespace IO.Swagger.Controllers
{
//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();
if (modeFormations == null)
if (modeFormations.Count() == 0)
{
ErreurDTO erreur = new ErreurDTO()
{
@ -284,7 +273,7 @@ namespace IO.Swagger.Controllers
{
//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();
if (origineFormations == null)
if (origineFormations.Count() == 0)
{
ErreurDTO erreur = new ErreurDTO()
{
@ -322,7 +311,7 @@ namespace IO.Swagger.Controllers
{
//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);
if (formations == null)
if (formations.Count() == 0)
{
ErreurDTO erreur = new ErreurDTO()
{
@ -352,7 +341,7 @@ namespace IO.Swagger.Controllers
{
//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();
if (statutFormations == null)
if (statutFormations.Count() == 0)
{
ErreurDTO erreur = new ErreurDTO()
{
@ -382,7 +371,7 @@ namespace IO.Swagger.Controllers
{
//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();
if (typeFormations == null)
if (typeFormations.Count() == 0)
{
ErreurDTO erreur = new ErreurDTO()
{

Loading…
Cancel
Save