示例#1
0
 /// <summary>
 /// The summary of the referred to item in the data system to which the supplied Collator belongs
 /// </summary>
 public virtual Summary Summary(Collator coll)
 {
     if (Id == null || string.IsNullOrEmpty(DataType))
     {
         return(null);
     }
     if (summary == null && ItemId != null)
     {
         summary = coll.Get <Summary>(ItemId);
     }
     return(summary);
 }
示例#2
0
        // Get the discounted products
        public List <ProductSummary> Discounted()
        {
            // Get ProductSummary type objects as these are designed to be used as references to other pages.
            // The first type argument to Get is the type returned, the second is the type in which you
            // define the filter/query
            // Rather than providing an IQueryable as a source, the content data API takes an argument which
            // is a function on an IQueryable returning another IQueryable of the same type.
            // Note that you can use parent types here and this will return both TileSummary and EquipmentSummary
            // typed objects, running the query across every type which inherits from ProductSummary. This is very
            // useful for information architecture of any complexity.
            var discounted = Collator.Get <ProductSummary, ProductSummary>(iq => iq.Where(ps => ps.Discount > 0m));

            return(discounted.ToList());
        }