Bài đăng

Hiển thị các bài đăng có nhãn MVC5

Hướng dẫn sử dụng Template premium

Hình ảnh
Hướng dẫn sử dụng Template premium Download project

Hướng dẫn General code tự động trong ASP.NET MVC

Hình ảnh

Hướng dẫn xây dựng Website Asp net MVC5 (Tự động sinh code)

Hình ảnh

11. Examining the details and delete methods (chưa dịch)

Hình ảnh
In this part of the tutorial, you'll examine the automatically generated  Details  and  Delete  methods. Examining the Details and Delete Methods Open the  Movie  controller and examine the  Details  method. public ActionResult Details ( int ? id ) { if ( id == null ) { return new HttpStatusCodeResult ( HttpStatusCode . BadRequest ); } Movie movie = db . Movies . Find ( id ); if ( movie == null ) { return HttpNotFound (); } return View ( movie ); } The MVC scaffolding engine that created this action method adds a comment showing a HTTP request that invokes the method. In this case it's a  GET  request with three URL segments, the  Movies  controller, the  Details  method and a  ID  value. Code First makes it easy to search for data using the  Find  method. An important security feature built into the method i...

10. ADDING VALIDATION (CHƯA DỊCH)

Hình ảnh
In this this section you'll add validation logic to the  Movie  model,  and you'll ensure that the validation rules are enforced any time a user  attempts to create or edit a movie using the application. Keeping Things DRY One of the core design tenets of ASP.NET MVC is   DRY  ("Don't Repeat  Yourself"). ASP.NET MVC encourages you to specify functionality or behavior only  once, and then have it be reflected everywhere in an application. This reduces  the amount of code you need to write and makes the code you do write less error  prone and easier to maintain. The validation support provided by ASP.NET MVC and Entity Framework Code  First is a great example of the DRY principle in action. You can declaratively  specify validation rules in one place (in the model class) and the rules  are enforced everywhere in the application. Let's look at how you can take advantage of this validation support in the...

Bài đăng phổ biến từ blog này

Hướng dẫn cài đặt VRML Pad và Cortona 3D Viewer

[Share] CSDL Quản lý Shop Online

[Webform Tạo report trong Visual Studio 2015 C#