a bunch of stuff
This commit is contained in:
@@ -10,31 +10,7 @@ namespace ApplianceRepair.Components.Pages
|
||||
{
|
||||
if (!cache.TryGetValue(nameof(HomePageModel), out Model))
|
||||
{
|
||||
Model = Defaults.DefaultHomePageContent;
|
||||
|
||||
var homePageRecord = await homePageReader.ReadLatestRecord();
|
||||
if (homePageRecord != null)
|
||||
{
|
||||
Model = new HomePageModel(homePageRecord);
|
||||
|
||||
var serviceCardRecords = await contentCardReader.ReadAllByPageAndGroup(nameof(Home), "Services");
|
||||
if (serviceCardRecords != null)
|
||||
{
|
||||
foreach (var record in serviceCardRecords)
|
||||
{
|
||||
Model.ServicesCards!.Add(new ContentCardModel(record));
|
||||
}
|
||||
}
|
||||
|
||||
var trustCardRecords = await contentCardReader.ReadAllByPageAndGroup(nameof(Home), "Trust");
|
||||
if (trustCardRecords != null)
|
||||
{
|
||||
foreach (var record in trustCardRecords)
|
||||
{
|
||||
Model.TrustCards!.Add(new ContentCardModel(record));
|
||||
}
|
||||
}
|
||||
}
|
||||
Model = await homePageReader.ReadLatestRecordWithModel(contentCardReader) ?? Defaults.DefaultHomePageContent;
|
||||
|
||||
var cacheOptions = new MemoryCacheEntryOptions()
|
||||
.SetAbsoluteExpiration(TimeSpan.FromHours(24))
|
||||
@@ -43,6 +19,5 @@ namespace ApplianceRepair.Components.Pages
|
||||
cache.Set(nameof(HomePageModel), Model, cacheOptions);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user