ASP. NET MVC Individual learning Notes view Pass to Controller

Source: Internet
Author: User

The first parameter is the action name, the second parameter is the controller name @using  (html.beginform ("CreateItem",  "Knoledge")) {        <fieldset>        <legend> Knolegemodels</legend>        <div class= "Editor-label" >             title: <input name= "M_strtitle " class="  />            "Createknoledge"  <input name= "M_struserid"  class= "Createknoledge"   />              Date: <input class= "Easyui-datebox"  name= "m_ Dateuploadtime " data-options=" Required:true,showseconds:false "                 value= "New date ();"  style= "width: 150px"  />             @Html. ActionLink ("Back to list",  "Index")             <input type= "Submit"   Value= "Create"  />        </div>         <div class= "Editor-label" >              Description:        </div>         <div class= "Editor-label" >             <textarea name= "M_strdesc"  class= "Knoledgedesc" ></textarea >        </div>    </fieldset>}
  //each parameter corresponds to the name  public actionresult createitem of the View input (string m_ Struserid, string m_strtitle, string m_strdesc, string m_dateuploadtime)          {             //database operation, is my own encapsulation, can ignore.             Dictionary<string, string>  _dictParam = new Dictionary<string, string> ();             _dictparam.add ("Id",  guid.newguid (). ToString ());             _dictparam.add ("M_ strUserID ",  m_struserid);             _ Dictparam.add ("M_strtitle",  m_strtitle);             _dictparam.add ("M_strdesc",   m_strdesc);             _dictparam.add ("M_ Dateuploadtime ",  m_dateuploadtime);             string _strSql =  "Insert into knoledge (id,m_struserid,m_strtitle,m_strdesc,m_ Dateuploadtime,m_strhot)  values (: Id,:m_struserid,:m_strtitle,:m_strdesc,to_date (: M_dateUploadTime, ' Yyyy-mm-dd '), 0) ";             int iresult  = commonfunction.oraexecutenonquery (_strsql, _dictparam);             //jump to which view             return view ("Create");         }

Less accustomed to the Entity Framework one is the feeling that the native SQL is more controllable, and the second is that EF is not universal enough. (In fact, it is not very clear to play-_-| | | -_-||| )

ASP. NET MVC Individual learning Notes view Pass to Controller

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.