Skip to content

Commit eaafd37

Browse files
committed
Fix for saving the theme in admin settings
1 parent f7b54cd commit eaafd37

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/App/Pages/Admin/Settings/Index.cshtml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ public async Task<IActionResult> OnGetAsync()
4242
return Page();
4343
}
4444

45-
public IActionResult OnPost()
45+
public async Task<IActionResult> OnPost()
4646
{
4747
if (!ModelState.IsValid)
4848
{
4949
return Page();
5050
}
5151

52-
_db.CustomFields.SaveBlogSettings(BlogItem);
52+
await _db.CustomFields.SaveBlogSettings(BlogItem);
5353

5454
Message = Resources.Updated;
5555

src/Core/Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>netcoreapp2.1</TargetFramework>
5-
<Version>2.0.2.8</Version>
5+
<Version>2.0.2.9</Version>
66
</PropertyGroup>
77

88
<ItemGroup>

src/Core/Data/Repositories/CustomFieldRepository.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ public Task<BlogItem> GetBlogSettings()
4242

4343
public async Task SaveBlogSettings(BlogItem blog)
4444
{
45-
var title = _db.CustomFields.Single(f => f.AuthorId == 0 && f.Name == Constants.BlogTitle);
46-
var desc = _db.CustomFields.Single(f => f.AuthorId == 0 && f.Name == Constants.BlogDescription);
47-
var items = _db.CustomFields.Single(f => f.AuthorId == 0 && f.Name == Constants.BlogItemsPerPage);
48-
var cover = _db.CustomFields.Single(f => f.AuthorId == 0 && f.Name == Constants.BlogCover);
49-
var logo = _db.CustomFields.Single(f => f.AuthorId == 0 && f.Name == Constants.BlogLogo);
50-
var theme = _db.CustomFields.Single(f => f.AuthorId == 0 && f.Name == Constants.BlogTheme);
45+
var title = _db.CustomFields.Where(f => f.AuthorId == 0 && f.Name == Constants.BlogTitle).FirstOrDefault();
46+
var desc = _db.CustomFields.Where(f => f.AuthorId == 0 && f.Name == Constants.BlogDescription).FirstOrDefault();
47+
var items = _db.CustomFields.Where(f => f.AuthorId == 0 && f.Name == Constants.BlogItemsPerPage).FirstOrDefault();
48+
var cover = _db.CustomFields.Where(f => f.AuthorId == 0 && f.Name == Constants.BlogCover).FirstOrDefault();
49+
var logo = _db.CustomFields.Where(f => f.AuthorId == 0 && f.Name == Constants.BlogLogo).FirstOrDefault();
50+
var theme = _db.CustomFields.Where(f => f.AuthorId == 0 && f.Name == Constants.BlogTheme).FirstOrDefault();
5151

5252
if (title == null) _db.CustomFields.Add(new CustomField { AuthorId = 0, Name = Constants.BlogTitle, Content = blog.Title });
5353
else title.Content = blog.Title;

0 commit comments

Comments
 (0)