Skip to content

Commit

Permalink
Fix for saving the theme in admin settings
Browse files Browse the repository at this point in the history
  • Loading branch information
rxtur committed Oct 17, 2018
1 parent f7b54cd commit eaafd37
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/App/Pages/Admin/Settings/Index.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ public async Task<IActionResult> OnGetAsync()
return Page();
}

public IActionResult OnPost()
public async Task<IActionResult> OnPost()
{
if (!ModelState.IsValid)
{
return Page();
}

_db.CustomFields.SaveBlogSettings(BlogItem);
await _db.CustomFields.SaveBlogSettings(BlogItem);

Message = Resources.Updated;

Expand Down
2 changes: 1 addition & 1 deletion src/Core/Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<Version>2.0.2.8</Version>
<Version>2.0.2.9</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions src/Core/Data/Repositories/CustomFieldRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ public Task<BlogItem> GetBlogSettings()

public async Task SaveBlogSettings(BlogItem blog)
{
var title = _db.CustomFields.Single(f => f.AuthorId == 0 && f.Name == Constants.BlogTitle);
var desc = _db.CustomFields.Single(f => f.AuthorId == 0 && f.Name == Constants.BlogDescription);
var items = _db.CustomFields.Single(f => f.AuthorId == 0 && f.Name == Constants.BlogItemsPerPage);
var cover = _db.CustomFields.Single(f => f.AuthorId == 0 && f.Name == Constants.BlogCover);
var logo = _db.CustomFields.Single(f => f.AuthorId == 0 && f.Name == Constants.BlogLogo);
var theme = _db.CustomFields.Single(f => f.AuthorId == 0 && f.Name == Constants.BlogTheme);
var title = _db.CustomFields.Where(f => f.AuthorId == 0 && f.Name == Constants.BlogTitle).FirstOrDefault();
var desc = _db.CustomFields.Where(f => f.AuthorId == 0 && f.Name == Constants.BlogDescription).FirstOrDefault();
var items = _db.CustomFields.Where(f => f.AuthorId == 0 && f.Name == Constants.BlogItemsPerPage).FirstOrDefault();
var cover = _db.CustomFields.Where(f => f.AuthorId == 0 && f.Name == Constants.BlogCover).FirstOrDefault();
var logo = _db.CustomFields.Where(f => f.AuthorId == 0 && f.Name == Constants.BlogLogo).FirstOrDefault();
var theme = _db.CustomFields.Where(f => f.AuthorId == 0 && f.Name == Constants.BlogTheme).FirstOrDefault();

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

0 comments on commit eaafd37

Please sign in to comment.