Skip to main content

Posts

Showing posts from October, 2013

Create dynamic content using Razor templates

This article is explaining the usage of Razor template and effectiveness of these templates. Let's consider one scenario, when you have to send emails to different users with dynamic data which is different for different users. Example shown below is a basic example. Think of some complex scenario where plenty of data need to be changed and also require some styling. To start work on one simple example, right click on your website folder and create a new blank @view. Name it as "Useremail.cshtml". Paste the mentioned code there. Useremail.cshtml     < html >    < body   style =" font-family :  Arial ;  font-size :  smaller">     < p > Dear  @ Model.Name, </ p >      < p > A new account has been created for you to access Application with                            username:  < b > @ Model.Username  </ b ></ p >      < p > You can access the application at  @ Model.AppUrl. </ p &g