MVC: Razor Syntax

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.

1-razor-syntax

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

2-razor-syntax

Leave a Reply

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

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s