I have created an ASP.NET Core 7 Web API and successfully created about 30 endpoints which are working fine. Just got stuck in some weird situation that I have created one endpoint with this signature:
[HttpPost]
[Route("[action]")]
public async Task<IActionResult> UsersBySearch([FromBody] UserSearchOptions prmUSO)
{
var (Result, Response) = await UOW.Users.GetUsersBySearch(prmUSO);
if (Result != null)
{
return Ok(Response);
}
else
{
return BadRequest(new ServiceErrorMsg { Message = new() { "Error fetching user list"}});
}
}
where the UserSearchOptions
class looks like this:
public class UserSearchOptions
{
public int Skip;
public int PageSize;
public string? SortCol;
public string? SortColDir;
public string? searchVal;
public int UserId;
}
Now when I run this, my Swagger API not showing this API with input class object as input parameter, also when I call it with Postman, the API is getting called but the parameter values are not receiving in it.
Could some please help to sort out this problem.