Click here to Skip to main content
15,879,490 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have three levels of route attribute inheritance :

ClassA : ClassB public string Concat(..) [Route(..)] ClassB : ClassC [Route(..)] ClasseC: ControllerBase

The problem is that service "Concact" in the ClasseA never working !

Here is my code with details:

* UniteAdministrativeController :



* ControleurRechercheBase :


* ControleurObtentionBase :



My problem here is i can't execute the action HTTPPOST "Concat" , and when i test it with POSTMAN: https://localhost:44339/api/v1.0/UniteAdministrative/

I get error 415,

How can I fix it? Or any idea to modify it ?

What I have tried:

public class UniteAdministrativeController : ControleurRechercheBase<Entites.UniteAdministrative, DbContext>     
{
      protected readonly IRechercheDAO<Entites.UniteAdministrative, DbContext> rechercheDAOtest;
      public UniteAdministrativeController(IRechercheDAO<Entites.UniteAdministrative, DbContext> rechercheDAO)
 : base( rechercheDAO)
 {
     rechercheDAOtest = rechercheDAO;
 }      

 [HttpPost]
 [Route("Concat")]

 public string Concat([FromBody] CritereRecherche critereRecherche)
 {
     //...
 }
}





[Route("api/v{version:apiVersion}/[controller]")]
  public abstract class ControleurRechercheBase<TEntite, TContexte> : ControleurObtentionBase<TEntite>
     where TEntite : class
     where TContexte : ContexteBase
{
     protected readonly IRechercheDAO<TEntite, TContexte> RechercheDao;

     protected ControleurRechercheBase(IRechercheDAO<TEntite, TContexte> rechercheDAO);

 [HttpPost("Recherche")]
 public Task<IActionResult> Rechercher([FromBody] CritereRecherche critereRecherche);
}




[Route("api/v{version:apiVersion}/[controller]")]
   public abstract class ControleurObtentionBase<T> : ControleurBase where T : class
{           

     protected ControleurObtentionBase();

  [HttpGet]
  [HttpGet("{parametre}")]
  [ProducesAttribute("application/json", new[] { })]

  public Task<IActionResult> Get(string parametre);
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900