protected BlockModel GetBlock(string name)
 {
     var ctBlock = ContentType.Block.ToString();
     var content = _ctx.DContents.FirstOrDefault(c => c.TypeId == ctBlock && c.Name == name);
     var block = new BlockModel();
     if (content != null)
     {
         block.Name = content.Name;
         block.Title = content.Title;
         block.Content = content.Content;
     }
     return block;
 }
Exemple #2
0
 public static BlockModel GetBlock(string name, ContentType type)
 {
     using (var ctx = new OffwindEntities())
     {
         var ctBlock = type.ToString();
         var content = ctx.DContents.FirstOrDefault(c => c.TypeId == ctBlock && c.Name == name);
         var block   = new BlockModel();
         if (content != null)
         {
             block.Name    = content.Name;
             block.Title   = content.Title;
             block.Content = content.Content;
             block.Image   = content.Announce;
         }
         return(block);
     }
 }
Exemple #3
0
 public static BlockModel GetBlock(string name,ContentType type)
 {
     using (var ctx = new OffwindEntities())
     {
         var ctBlock = type.ToString();
         var content = ctx.DContents.FirstOrDefault(c => c.TypeId == ctBlock && c.Name == name);
         var block = new BlockModel();
         if (content != null)
         {
             block.Name = content.Name;
             block.Title = content.Title;
             block.Content = content.Content;
             block.Image = content.Announce;
         }
         return block;
     }
 }