ASP. NET MVC submits a more complex object to a WCF Service

Source: Internet
Author: User

The Jquery.ajax () method of executing a WCF service http://www.cnblogs.com/insus/p/3727875.html we have practice in an ASP. NET MVC application, the POST data goes to WCF Service and execute the method.

The exercise in this article is to commit a more complex object to the WCF service execution method. In the previous article, it passed only two parameters. If we develop in the usual, need to pass too many parameters, that need to write a number of parameters. Therefore, this article is generated, and more parameters are created as an object. Then just pass this object to the WCF service.

Below, under the ASP. NET MVC directory structure models, create an object that supports WCF service:



In the interface of the WCF service, create two methods, one to pass in the primary health value, to get a single record ienumerable<insus.net.models.fruitkind> Getbyprimarykey (byte FRUITKIND_NBR). The other is the Update data void update (Insus.NET.Models.Kind k):

Here are the two methods to implement:

Next, we want to add a column to this example in the "ASP. NET MVC method for calling WCF service" http://www.cnblogs.com/insus/p/3720547.html:

The results of the operation are shown below:


Go to the controller and add a View action (action):


This allows the user to click on the "Details" link, which will jump to this view. Displays this record and allows users to make changes and updates:


Tags 1 and 2 are HTML markup as well as reference qjery and custom JS libraries.

Tag 3 Load data:

Tag 4, which dynamically generates a record of each field. :

Tag 5, get the parameters on the address bar:

Flag 6, Update the Ammonium button event:

Real-time Operation Demo:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.