public async Task <Response> Handle(Request request)
 {
     return(new Response()
     {
         HomePage = HomePageApiModel.FromHomePage(await _context.HomePages
                                                  .Include(x => x.Tenant)
                                                  .SingleAsync(x => x.Id == request.Id && x.Tenant.UniqueId == request.TenantUniqueId))
     });
 }
Exemple #2
0
            public async Task <Response> Handle(Request request)
            {
                var homePages = await _context.HomePages
                                .Include(x => x.Tenant)
                                .Where(x => x.Tenant.UniqueId == request.TenantUniqueId)
                                .ToListAsync();

                return(new Response()
                {
                    HomePages = homePages.Select(x => HomePageApiModel.FromHomePage(x)).ToList()
                });
            }
Exemple #3
0
            public async Task <Response> Handle(Request request)
            {
                var homePage = await _cache.FromCacheOrServiceAsync(() => _context.HomePages
                                                                    .Include(x => x.Tenant)
                                                                    .SingleOrDefaultAsync(x => x.Tenant.UniqueId == request.TenantUniqueId),
                                                                    HomePagesCacheKeyFactory.Get(request.TenantUniqueId));

                return(new Response()
                {
                    HomePage = homePage == null ? null : HomePageApiModel.FromHomePage(homePage)
                });
            }