为什么我收到空值?如何解决这个问题?

时间:2017-05-25 22:11:53

标签: asp.net-web-api asp.net-web-api2

我在api控制器中发送邮件请求使用邮递员我尝试了两种方式首先我使用viewmodel我得到了空值我之后我使用jObject作为收到的参数发布它获取值但当我尝试转换时将它重视为对象,它没有通过异常......我的代码......

 public async Task<IHttpActionResult> PostCommunityAsync(JObject json_obj)
 {
        dynamic jsondata = json_obj;//In this get recieve value there

        JObject com = jsondata.Community;//gets null com contains null after 
        the breakpoint hit...Community is my MOdel class//

        var commu = com.ToObject<Community>();
        var community = commu.ToObject<Community>();//through null referene 
         exception//
        await _as.abc(commu);
        return Ok();
    }

0 个答案:

没有答案