Thank you all for giving an insights about how they are handling. I have gathered lots of knowledge from here. I liked @MartinHN using Razor parser with concrete Model of Data.
However, something it did not worked very well for me.
Requirement:
I have to store email templates such that I can display the same to
Stakeholders anytime. Thus it should available to browse through
Intranet - preferably through sae website as hosted API.
The front end designers should be able to modify templates easily.
Thus I want to store it in plain HTML format so that designer does
not have to go through on too much of technical details.
The email templates should be easily available for modifications for
Administrators (future requirement). In near future, there will be
different notifications for SMS, Screen. Thus the templates are
different.
Based on these requirements, I did the following:
Since I was using MVC, I created a folder called "STATIC" that is
available to be browsed directly (and MVC engine/ http handler
exclude this folder from performing its MVC activities).
With this approach I could easily achieve first requirement and I
could send my link to the stake holders as
http://api.aksdfjl.com/static/welcomeemailtemplate.html
Each email template has given its own html, thus it was easy for the
designer to access the same and refer it on their repository as a
shortcut to my repository folder. The Html has inline CSS and it is
completely an independent html - per Email.
The last main requirement was about maintaining these design and user can modify the same. Well then definitely I don't want to deal through file system at all. What I did is now these notifications stores into the database and I initialize them once. After that the Admin panel has got a wysiwyg html editor that can give them a quick preview as well as control on what it should send to.
Now I wanted to make sure that future requirements are easily handled and since my company was introducing different notifications for different mode such as E-mail, Screen, SMS notifications. I decided to extend the software design with the help of template initializer XML that store these answers.
The mother of all template called - MessageTemplates.xml stores different information that I need to initialize different type of templates i.e. email ,sms, screen et al.

Here is how the code looks like now.
[HttpGet]
[Route("applications/initializenotificationtemplate")]
public IHttpActionResult InitializeNotificationTemplate()
{
return
InitializeNotificationTemplate(Path.Combine(HostingEnvironment.ApplicationPhysicalPath,
@"Static\InitializeData\MessageTemplates.xml"));
}
[NonAction]
public IHttpActionResult InitializeMailTemplate(string filePath)
{
try
{
_applicationService.InitializeTemplate(filePath);
return Ok("Application Notification templates are initialized.");
}
catch (Exception ex)
{
return InternalServerError(ex);
}
}
_applicationService.InitializeTemplate has the following definition:
public bool InitializeTemplate(string filePath)
{
if (string.IsNullOrEmpty(filePath))
{
throw new ArgumentNullException("File Path");
}
if (!File.Exists(filePath))
{
throw new FileNotFoundException(filePath);
}
var data = _notificationTemplateService.Get();
var exceptionMessages = string.Empty;
if (data != null)
{
var historicalTemplates = data.ToList();
historicalTemplates.ForEach((d) => _notificationTemplateService.Delete(d, out exceptionMessages));
}
XDocument xmlDocument = XDocument.Load(filePath);
IEnumerable<NotificationTemplate> templates = (from template in xmlDocument.Descendants("Template")
select new NotificationTemplate()
{
Title = template.Element("Subject").Value,
Description = template.Element("Body").Value,
Type = (NotificationTypeOptions)Enum.Parse(typeof(NotificationTypeOptions), template.Element("Type").Value, true),
Category = (NotificationCategoryOptions)Enum.Parse(typeof(NotificationCategoryOptions), template.Attribute("category").Value, true),
}).ToList();
foreach (var t in templates)
{
var path = Path.Combine(Path.GetDirectoryName(filePath), Regex.Replace(t.Description, @"\t|\n|\r| ", ""));
if (File.Exists(path))
{
StreamReader reader = new StreamReader(path);
t.Description = reader.ReadToEnd();
}
else
{
t.Description = string.Empty;
}
}
return _notificationTemplateService.InsertRange(templates, out exceptionMessages);
}
This is how my model looks like that is same as database model (code first - EF approach).
public class NotificationTemplate : IdentityBase
{
public string Category { get; set; }
public NotificationTypeOptions Type { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public NotificationTemplate()
{
Type = NotificationTypeOptions.Email;
}
}
[Flags]
public enum NotificationTypeOptions
{
Email = 0,
Screen = 1,
}
For the very first time, when I install my application I call initialize API call that install my notification templates into the database and all other options are available and ready to use.
Now with this approach I made everyone happy in the organisation and it has a great strength to extend this further so that it is easy for me to introduce a new templates as well.