I'm having a problem with a Get method in my Web API: The API gets the object but with the default values.
For instance:
myRefitClient.GetSummary(new MyClass() { Prop = 1 });
The Web API correctly receives a MyClass
instance, but Prop
is 0!
This is all that I have:
The Get method (Controller in the Web API):
[HttpGet]
async Task<ActionResult> Get([FromQuery]MyClass req)
MyClass is:
public class MyClass
{
public int Prop { get; set; }
}
and my Web API interface for Refit is:
public interface IMyWebApi
{
[Get("/api/mycontroller")]
Task<PositionSummary> GetSummary(MyClass req);
}
So, as I said, upon the call:
service.GetSummary(new MyClass() { Prop = 1 });
I'm getting a MyClass
Instance in my Controller, but Prop is 0, instead of 1.
What am I doing wrong?