The reception in MVC

Source: Internet
Author: User


Foreground page time Format modified:

@item. Createtime.tostring ("yyyy-mm-dd hh:mm:ss")

Foreground method call Pass parameter:

<a href="#" title=" edit " onclick= " Openprintmode (' edit ', ' @item. KeyId '); "> Edit </a>

The method of the foreground controller in the asynchronous tuning:

   varSaveData =function () {varPostData ={printerkeyid: $ ("#hid_printkeyId"). Val (), Supplierkeyid: $ ("#hid_suppierkeyId"). Val (), printertype:$ ("#printType"). Val (), PrinterName: $ ("#printName"). Val (), Printercode: $ ("#printCode"). Val ()};        Console.log (PostData); $.ajax ({URL:'/supplier/addprinter', type:'POST', Data:postdata, Success:function (res) {if(Res.flag) {Search (1); }Else{alert (res.msg);    }            }        }); }

See the Controller in the method: This is an entity, and there are 5 parameters in the entity, respectively,

Printerkeyid, Supplierkeyid, Printertype, PrinterName, Printercode.
[HttpPost] PublicJsonresult AddPrinter (Supplierprinteraddrst request) {Try{request. Requestvpiaouserkeyid=Userhelper.currentuserid; SUPPLIERPRINTERADDRSP Response= Wcfinvoke.invoke (v =V.supplierprinteradd (Request)); if(Response. Result.responsecode = =0)                {                    returnJson (New{flag =true, msg ="saved successfully" }); }                Else                {   //responsecode==1 encoding or name duplication                    returnJson (New{flag=false, msg=Response.                Result.errormessage}); }            }            Catch(Exception ex) {Loghelper.error ("Save Printer List exception, execute Suppliercontroller.addprinter=>supplierprinteradd exception", ex); returnJson (New{flag =false, msg =Ex.            Message}); }        }

The reception in MVC

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.