i have this action in my controller. But when i provide mapid. geoid or the list in body its not not mapped properly from query into the parameters.
Unable to figure out what's wrong with this action. I do have similar actions but they are found to be working properly.
Any help or pointers are welcomed.
[HttpPost]
[Consumes(MediaTypeNames.Application.Json)]
[ProducesResponseType(typeof(List<MapViewModel>), StatusCodes.Status201Created)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> CreateMap([FromQuery, Required] string mapId,
[FromQuery, Required] string geoId,
[FromBody, Required] List<MapViewModel> mapsList)
{
throw new NotImplementedException();
}
CodePudding user response:
Query name must match with [FromQuery] paramater name. Your query must contains mapId and geoId (I is upper case).
CodePudding user response:
Surprisingly there was no issue with the code. What i came to know is in my above skeleton code if the parameters are not is use then values from FromQuery are not mapped.
But when i just did var a = mapId; then parameter of mapId started showing value from FromQuery.