asp.net webapi 2 post parameter is always null

前端 未结 2 1789
抹茶落季
抹茶落季 2021-01-24 23:39

I have been trying to figure this our for the last hour, but I can\'t see what\'s wrong with it

the post is from a xamarin app that I\'m writing, using restsharp portabl

2条回答
  •  抹茶落季
    2021-01-25 00:06

    Do you always send the same parameters? If so, could you create a static object instead of using a dynamic one? Something like an EventRequest that you pass in instead?

    public class EventRequest
    {
        public int CheckinCount { get; set; }
        public int EventId { get; set; }
        public int OrderNo { get; set; }
    }
    

    Your Post action then becomes:

    public IHttpActionResult Post(EventRequest request) {
        // do something with request
        return Ok();
    }
    

提交回复
热议问题