示例#1
0
 public IQuote GetQuotes(int level)
 {
     try
     {
         IItemPathSettings quotePath = _contextRepository.GetRootItem <IItemPathSettings>();
         if (quotePath != null)
         {
             var quotes = _contentRepository.GetItem <IQuoteFolder>(new GetItemByPathOptions {
                 Path = quotePath.QuoteUrl
             });
             if (quotes != null)
             {
                 List <IQuote> quotesList = quotes.Quotes.ToList();
                 if (quotesList.Count > level)
                 {
                     return(quotesList.ElementAt(level));
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Sitecore.Diagnostics.Log.Error(ex.Message, ex, this);
     }
     return(null);
 }
示例#2
0
 public QuoteServiceTests()
 {
     itemPathSettings = Substitute.For <IItemPathSettings>();
 }