private static IHtmlString _renderPartial(HtmlHelper htmlHelper, ArchetypeFieldsetModel fieldsetModel, string partialPath, ViewDataDictionary viewDataDictionary)
{
var context = HttpContext.Current;
if (fieldsetModel == null || context == null)
{
return new HtmlString("");
}
var sb = new StringBuilder();
//default
var pathToPartials = "~/Views/Partials/Archetype/";
if (!string.IsNullOrEmpty(partialPath))
{
pathToPartials = partialPath;
}
var partial = string.Format("{0}{1}.cshtml", pathToPartials, fieldsetModel.Alias);
if (System.IO.File.Exists(context.Server.MapPath(partial)))
{
sb.AppendLine(htmlHelper.Partial(partial, fieldsetModel, viewDataDictionary).ToString());
}
else
{
LogHelper.Info<ArchetypeModel>(string.Format("The partial for {0} could not be found. Please create a partial with that name or rename your alias.", context.Server.MapPath(partial)));
}
return new HtmlString(sb.ToString());
}