@{
string message = "Hello, Razor!";
}
<p>@message</p>
<p>Welcome to Razor Markup!</p>
@model MyModel
<p>Name: @Model.Name</p>
<p>Age: @Model.Age</p>
@{
int count = 5;
}
<p>There are @count items in the list.</p>
@{
int x = 10;
int y = 20;
int sum = x + y;
}
<p>The sum of @x and @y is @sum.</p>
@{
string productName = "ASP.NET Core";
}
<p>Product Name: @productName</p>
@if (UserIsAuthenticated)
{
<p>Welcome, authenticated user!</p>
}
else
{
<p>Please log in to access this content.</p>
}
<ul>
@foreach (var item in itemList)
{
<li>@item.Name</li>
}
</ul>
@model User
<p>User Name: @Model.UserName</p>
<p>Email: @Model.Email</p>