MVC: Razor Syntax

Please see my other MVC articles.

Implementing logic into the Presentation layer.

Perhaps one of the best features provided by MVC is the ability to implement logic into the UI to control output.
To illustrate this feature, I’ll begin where my MVC: Action Methods using GET & POST article left off.

As you can see, I’ve updated my View to determine the associate’s territory for the purpose of displaying a specific message to them.
In their territory is California (and our company is in the Pacific Northwest), then obviously they miss the sun!
Also, it might be helpful to display the current data when they view this page in case they print it out.


Now when I complete the form and receive the confirmation message, I’m greeted with a message about the sun and the current date.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s