The seventh section describes the addition of the properties of the class in the model, because there are already tables in the database, there are no new columns in the table, so you can delete the database or add a new column to the database, and you can add a class to the controller that initializes the database. and add code to initialize the database in Global.asax
(1) @Html. Displaynamefor (model = model. Title) is the display column name,
(2) @Html. Displayfor (ModelItem = Item. Title) is the contents of the Display column
(3) @Html. ActionLink ("Create New", "create") is a hyperlink that jumps to the Create page in model, referring to the Create method in the controller;
(4) @Html. ActionLink ("edit", "edit", new {id=item.id}) edit the page;
(5) @using (Html.BeginForm ()) {@Html. ValidationSummary (True)} is used for client-side validation, and its html.beginform () indicates that it is displayed on this page
(6) <div class= "Editor-label" > @ Html.labelfor (model = model). Time) Tags </div> <div class= "Editor-field" > @Html. editorfor ( Model = model. Time) edit box @Html. validationmessagefor (model = > Model. TIME) Verify legality error display </div>
Note that the System needs to be referenced when establishing the Movieinitializer class . Data. Entity, and the dropcreatedatabaseifmodelchanges parameter is modified to Moviedbcontext, which defaults to DbContext, otherwise you will be prompted not to rewrite the seed method , the parameters of seed are consistent with dropcreatedatabaseifmodelchanges, and when data is added or deleted, the function deletes the database and creates a new
The eighth section describes the validity of the page validation input information, first of all in the client verification, validation passed after the server to verify. If special validation is required, you only need to modify the additions in the model's class.[DisplayFormat (dataformatstring< Span class= "PLN" > = < span class= "str" > "{0:d}" )][displayformat (dataformatstring = )] is a format validation.
The Nineth section describes the security mechanism, generally do not delete the information directly, but first through the Get method to find the information to be deleted, and then display the details to the page, and then through the user confirmation to delete the Post method to delete information
MVC Learning Four