0

I have html page consisting of JqGrid. JqGrid is bind through JSon data. There are multiple rows in a grid. User can edit the values in Grid and when he is finally done with manipulation then data is going to post back at Server using Web Api.

Presently I am using the Post method with following signature :-

public void Put(JObject u)
{
 //here iteration is made on Jobject data and finally changes saved to DB
}

Please suggest if this fine with Web Api context or there is better way to update collection in Web Api.

4

1 回答 1

1
  • 对于一个小项目,你的方法完全没问题。
  • 对于更大的项目,我将 jQuery 与 WCF Web 服务一起使用,如下所示:
    [ServiceContract]
    public interface IMyService
    {
      [OperationContract]
      [WebInvoke(Method = "POST",
                 RequestFormat = WebMessageFormat.Json,
                 ResponseFormat = WebMessageFormat.Json)]
      MyAnswer DoWork(MyData data);
      // ...

但请注意:我用 Fiddler 调试了好几个小时才让它按我想要的方式工作。

于 2012-10-08T04:41:52.963 回答