-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
This issue has been moved from a ticket on Developer Community.
So I have a simple requirement to gather logging data from a WASM client into a Web API.
NOTE we are not using Entity Framework...
I have created the following class:
public class EventInformation
{
public string Location;
public string Context;
public int Severity = 1;
}
With a simple web API target:
[Route("[controller]")]
[ApiController]
public class UserStateController : ControllerBase
{
[HttpPost]
[Route("LogEvent")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public IActionResult LogEvent([FromBody] EventInformation logData)
{
string Context = logData.Context;
string Location = logData.Location;
int Severity = logData.Severity;
return Ok();
}
}
I run it with the swagger.. with this json payload
{
"Context": "hello",
"Location": "world",
"Severity": 0
}
and get...
Runs to the break point all looks good except where is the data? Doesn't seem t be populating my logData parameter from my JSON body?
Original Comments
Feedback Bot on 11/24/2020, 10:30 PM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Feedback Bot on 11/25/2020, 07:19 PM:
Thank you for sharing your feedback! Our teams prioritize action on product issues with broad customer impact. See details at: https://docs.microsoft.com/en-us/visualstudio/ide/report-a-problem?view=vs-2019#faq. In case you need answers to common questions or need assisted support, be sure to use https://visualstudio.microsoft.com/vs/support/. We’ll keep you posted on any updates to this feedback.
Original Solutions
(no solutions)