Beispiel #1
0
        public async Task <IEnumerable <ThemeInfo> > RetrieveAsync(GetActiveThemes query)
        {
            return(await _cacheManager.GetAsync(string.Format(CacheKeys.ThemesCacheKey), async() =>
            {
                using (var context = _contextFactory.Create())
                {
                    var entities = await context.Themes
                                   .Where(x => x.Status == ThemeStatus.Active)
                                   .OrderBy(x => x.SortOrder)
                                   .ToListAsync();

                    if (entities.Any())
                    {
                        return _mapper.Map <IEnumerable <ThemeInfo> >(entities);
                    }

                    return new List <ThemeInfo>
                    {
                        new ThemeInfo
                        {
                            Id = Guid.NewGuid(),
                            Name = "Deafult",
                            Folder = "Default",
                            SortOrder = 1
                        }
                    };
                }
            }));
        }
Beispiel #2
0
        public async Task <IEnumerable <ThemeInfo> > RetrieveAsync(GetActiveThemes query)
        {
            return(await _cacheManager.GetAsync(string.Format(CacheKeys.ThemesCacheKey), async() =>
            {
                using (var context = _contextFactory.Create())
                {
                    var entities = await context.Themes
                                   .Where(x => x.Status == ThemeStatus.Active)
                                   .OrderBy(x => x.SortOrder)
                                   .ToListAsync();

                    return _mapper.Map <IEnumerable <ThemeInfo> >(entities);
                }
            }));
        }