HTML and CSS Reference
In-Depth Information
Figure 9-13.
Creating the Map view
3.
Notice in the
Map.cshtml
file that the referenced model is specified like this since
it is expecting to receive a collection of
State
classes. This happened because you
choose the list template when creating the view.
@model IEnumerable<Chapter
9
.Models.State>
4.
Add this
using
statement just after the model reference. This will enable you to
access the
State
properties through IntelliSense.
@using Chapter
9
.Models
5.
Replace the default contents of the body element with the following code. This
defines an
svg
element just like you did earlier. It then uses a
foreach
loop to
create a
path
element for each
State
defined in the model. Notice that it is storing
the
StateCode
column in the
id
attribute and the
StateName
column in the
class
attribute.