Example #1
0
 public virtual void DeleteItemTemplate(ItemTemplate itemTemplate)
 {
     if (GetItemTemplate(itemTemplate.Category, itemTemplate.TemplateName) != null)
     {
         var physicalPath = GetCategoryPhysicalPath(itemTemplate.Category);
         var itemFile = Path.Combine(physicalPath, itemTemplate.TemplateName + FileExtension);
         if (File.Exists(itemFile))
         {
             File.Delete(itemFile);
         }
         var thumbnail = Path.Combine(physicalPath, itemTemplate.TemplateName + ".png");
         if (File.Exists(thumbnail))
         {
             File.Delete(thumbnail);
         }
     }
 }
Example #2
0
 public virtual ItemTemplate GetItemTemplate(string category, string templateName)
 {
     var physicalPath = GetCategoryPhysicalPath(category);
     var itemFile = Path.Combine(physicalPath, templateName + FileExtension);
     if (File.Exists(itemFile))
     {
         ItemTemplate itemTemplate = new ItemTemplate() { TemplateName = templateName, Category = category };
         itemTemplate.TemplateFile = itemFile;
         var thumbnail = Path.Combine(physicalPath, templateName + ".png");
         if (File.Exists(thumbnail))
         {
             itemTemplate.Thumbnail = UrlUtility.GetVirtualPath(thumbnail);
         }
         return itemTemplate;
     }
     return null;
 }