Skip to content

Commit

Permalink
fix lineno in Validation (dotnet#1682)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rick-Anderson authored Jul 14, 2016
1 parent 2ef4cf9 commit 3c69cbc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions aspnet/tutorials/first-mvc-app/validation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ What's really nice about this approach is that neither the controller nor the ``
When you need to change validation logic, you can do so in exactly one place by adding validation attributes to the model (in this example, the ``Movie`` class). You won't have to worry about different parts of the application being inconsistent with how the rules are enforced — all validation logic will be defined in one place and used everywhere. This keeps the code very clean, and makes it easy to maintain and evolve. And it means that that you'll be fully honoring the DRY principle.

Using DataType Attributes
---------------------------
--------------------------

Open the *Movie.cs* file and examine the ``Movie`` class. The ``System.ComponentModel.DataAnnotations`` namespace provides formatting attributes in addition to the built-in set of validation attributes. We've already applied a ``DataType`` enumeration value to the release date and to the price fields. The following code shows the ``ReleaseDate`` and ``Price`` properties with the appropriate ``DataType`` attribute.

.. literalinclude:: start-mvc/sample2/src/MvcMovie/Models/MovieDateRatingDA.cs
:language: c#
:lines: 15-17,23-26
:lines: 16-19, 25-27
:dedent: 8
:emphasize-lines: 2,6

Expand Down

0 comments on commit 3c69cbc

Please sign in to comment.