Beginners Guide to Razor Syntax in MVC
MVC (Model View Controller) is becoming more and more in website development due to its scalable and adaptable architecture. One exciting feature in MVC is the View part. Most developers choose to have their front-end views written in Razor. Razor is a mixtuce of C# and HTML, hence the file extensions, cshtml. Razor takes a lot of fuss and hassle out of front-end development compared to Web Forms, as there were two separate files in web forms, one for HTML and one for Code behind. Web Forms also added a lot of un-needed and messy code which commonly made web pages in-accessible and large. Luckily, MVC and Razor solve all of these problems.
Lets look at what Razor can actually do and when it is used. Razor is used in the View part of MVC applications. It can parse HTML as well as simple C# like code. This enables the front end to simplify things like, looping through results, performing if statements and running functions. Lets look at the basic syntax of Razor.


