In the previous article jQuery. Ajax () method of executing the WCF Service http://www.cnblogs.com/insus/p/3727875.html, We have exercises in the asp.net mvc application, POST data to the wcf service and execute the method.
This exercise submits more complex objects to the wcf service Execution method. In the previous article, only two parameters are passed. If we usually develop and need to pass too many parameters, we need to write many parameters. Therefore, this article creates multiple parameters as an object. Then, you only need to pass this object to the wcf service.
Next, create an object that supports the wcf service under the directory structure Models of asp.net mvc:
Create two methods in the wcf service Interface. One is to pass in the primary key value and obtain the IEnumerable <Insus. NET. Models. FruitKind> GetByPrimaryKey (byte fruitKind_nbr) of a single record ). The other is to Update the data void Update (Insus. NET. Models. Kind k ):
The following two methods are implemented:
Next, we will refer to ASP. net mvc call methods for WCF Service in this example http://www.cnblogs.com/insus/p/3720547.html,:
The running result is as follows:
Add a view operation (Action) to the Controller ):
In this way, you can click the "details" link to jump to this view. This record is displayed and can be modified and updated by the user:
Mark 1 and Mark 2 are html markup and reference Qjery and custom js libraries.
Mark 3: load data:
Mark 4: each field is generated dynamically. :
Mark 5 to get the parameters in the address bar:
Mark 6 to update the button:
Real-time operation Demonstration: