Esempio n. 1
0
 public IList <SelectListItem> CreateReviewSelectListItems()
 => Cacher.FindOrCreateValue(Cache.CreateKey(nameof(CreateReviewSelectListItems)),
                             () =>
                             DB.Reviews.AsNoTracking().OrderByDescending(r => r.ReviewId).ConvertAll(
                                 r => new SelectListItem
 {
     Text  = $"{r.ReviewName} (#{r.ReviewId}) - {AspHelpers.GetDisplayName(r.ReviewScopeId)} - {AspHelpers.GetDisplayName(r.ReviewTypeId)}",
     Value = r.ReviewId.ToString()
 }).
                             ToList().
                             AsReadOnly(),
                             ShortCacheTimeout
                             ).Copy();
Esempio n. 2
0
 public static IList <SelectListItem> CreateReviewSelectListItems()
 => Cacher.FindOrCreateValWithSimpleKey(
     nameof(CreateReviewSelectListItems),
     () =>
 {
     using (var db = UloDbCreator())
     {
         return(db.Reviews.OrderByDescending(r => r.ReviewId).ConvertAll(
                    r => new SelectListItem
         {
             Text = $"{r.ReviewName} (#{r.ReviewId}) - {AspHelpers.GetDisplayName(r.ReviewScope)} - {AspHelpers.GetDisplayName(r.ReviewType)}",
             Value = r.ReviewId.ToString()
         }).
                ToList().
                AsReadOnly());
     }
 },
     UloHelpers.ShortCacheTimeout
     ).Copy();