ASP. net mvc Notes, asp. netmvcnotes

Source: Internet
Author: User

ASP. net mvc Notes, asp. netmvcnotes

  • Receive data directly in the form of parameters
  • The UpdaetModel in the Controller updates the Model to obtain the submitted data.
  • Service:
  • The Nuget Package Manager in solution manages the Nuget packages in solution.
  • Two Methods for model binding in Controller:
    1. Bind formulation requires model binding to transmit data to the Controller.

    Public ActionResult Edit_Post ([Bind (Include = "Gender, City, DateOfBirth")] Employee)

    2. In UpdateModel, pass the parameter to be updated or not to be updated

    UpdateModel <Employee> (employee, null, null, new string [] {"Name "});

    3. Define the IEmployee interface. The Employee inherits from the IEmployee interface.

    UpdateModel <IEmployee> (employee );
  • The Delete action of data must be performed in the Post data.
  • Field attribute control in EF, for example, [Required] and [Display (Name = "")] must be processed in partial class.
  • When editing information, you do not need to update the field. If you do not need to update the Name.
  • Lambda expression to count the number of employees in the Department
  • If you specify a View with a Suffix in Return View () in Controller, such as index. cshtml, you need to pass the complete path:
  •  

    Related Article

    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.