public dynamic GetModel(string viewName)
{
string modelPath = Path.Combine(_rootPathProvider.GetRootPath(), _settings.ModelsPath, viewName + ".js");
if (File.Exists(modelPath) == false)
return null;
var bodyStream = new StreamReader(modelPath);
try
{
var json = bodyStream.ReadToEnd();
return JsonHelpers.ParseJsonObject(json);
}
catch (Exception ex)
{
throw new ApplicationException("Error while parsing global model", ex);
}
finally
{
if (bodyStream != null)
bodyStream.Dispose();
}
}