Razor
Look at the top of the cshtml code. @ symbol is part of a special syntax called Razor that allows us to mix C# with our HTML.
Typing in that symbol tells the editor that we want to switch to use C#. It sets our Layout to null.
The Layout Property is used to set the path to our layout page. Using layout page gives us a way to specify the overall look and feel for our website pages without having to include that markup in each view.
Layout equals null tells MVC that this view isn't using a layout page. We take care of it in the following chapters.
Now, we want to include the information of the book in our page. Let's do it.
Inside the @ curly braces.
var seriesTitle = "The Amazing Spider-Man";
var issueNumber = 700;
var description = "<p>Final issue! Witness the final hours of Doctor Octopus' life and his one, last, great act of revenge! Even if Spider-Man survives... <strong>will Peter Parker?</strong></p>";
var artists = new string[]
{
"Script: Dan Slott",
"Pencils: Humberto Ramos",
"Inks: Victor Olazaba",
"Colors: Edgar Delgado",
"Letters: Chris Eliopoulos"
};
And call it in HTML code.
<div>
<h1>@seriesTitle</h1>
<h2>Issue #@issueNumber</h2>
<h5>Description:</h5>
<div>@description</div>
<h5>Artist:</h5>
<div>@artists</div>
</div>
It looks bad, huh?
To tell MVC not to intepreting our HTML directly, we need to use @HTML.Raw().
<div>
<h1>@seriesTitle</h1>
<h2>Issue #@issueNumber</h2>
<h5>Description:</h5>
<div>@HTML.Raw(description)</div>
<h5>Artist:</h5>
<div>@artists</div>
</div>