I am trying to do API call-in.NET 5.0 through the post method but getting System.InvalidOperationException: No route matches the supplied values. can you please help me with the same?
My code
[Route("api/[controller]")]
[ApiController]
public class CommonController : ControllerBase
{
private readonly IConfiguration _configuration;
private readonly ILanguages _Languages;
public CommonController(ILanguages Languages, IConfiguration configuration)
{
_Languages = Languages;
_configuration = configuration;
}
[HttpGet, Route("GetLanguages")]
public Languages GetLanguages()
{
try
{
return _Languages.GetLanguages();
}
catch (Exception)
{
throw;
}
}
}