Ejemplo n.º 1
0
 public NewViewModel(IPublishedContent content) : base(content)
 {
     var newItem = new NewItem
     {
         Title = content.GetPropertyValue<string>("title", string.Empty),
         ShortDes = content.GetPropertyValue<string>("shortdes", string.Empty),
         Content = content.GetPropertyValue<string>("content", string.Empty),
         Date = content.GetPropertyValue<DateTime>("date"),
         Image = Helper.GetMediaPicker(content, "image"),
         Link = umbraco.library.NiceUrl(content.Id)
     };
     NewItem = newItem;
 }
Ejemplo n.º 2
0
 public NewsViewModel(IPublishedContent content, int page,int pageSize) : base(content)
 {
     var news = content.Children.Skip((page - 1) * pageSize).Take(pageSize).ToList();
     var newItems = new List<NewItem>();
     foreach (var item in news)
     {
         var newItem = new NewItem();
         newItem.Title = item.GetPropertyValue<string>("title", string.Empty);
         newItem.ShortDes = item.GetPropertyValue<string>("shortdes", string.Empty);
         newItem.Date = item.GetPropertyValue<DateTime>("date");
         newItem.Image = Helper.GetMediaPicker(item, "image");
         newItem.Link = umbraco.library.NiceUrl(item.Id);
         newItems.Add(newItem);
     }
     NewItems = newItems;
 }