diff --git a/src/Naif.Blog.Core/Controllers/MetaWeblogController.cs b/src/Naif.Blog.Core/Controllers/MetaWeblogController.cs index b5fd5f4..989d2d0 100644 --- a/src/Naif.Blog.Core/Controllers/MetaWeblogController.cs +++ b/src/Naif.Blog.Core/Controllers/MetaWeblogController.cs @@ -88,7 +88,7 @@ private IActionResult GetUsersBlogs(string key, string userName, string password { new { - blogid = blog.Id, + blogid = blog.BlogId, blogName = blog.Title, url = $"http://{blogUrl}" } @@ -102,11 +102,11 @@ private IActionResult DeletePost(string key, string postId, string userName, str return CheckSecurity(userName, password, () => { var blog = _blogContext.Blog; - Post post = _blogManager.GetPost(blog.Id, p => p.PostId == postId); + Post post = _blogManager.GetPost(blog.BlogId, p => p.PostId == postId); if (post != null) { - post.BlogId = blog.Id; + post.BlogId = blog.BlogId; _blogManager.DeletePost(post); } @@ -119,7 +119,7 @@ private IActionResult EditPost(string postId, string userName, string password, return CheckSecurity(userName, password, () => { var blog = _blogContext.Blog; - Post match = _blogManager.GetPost(blog.Id, p => p.PostId == postId); + Post match = _blogManager.GetPost(blog.BlogId, p => p.PostId == postId); if (match != null) { @@ -151,7 +151,7 @@ private IActionResult GetPost(string postId, string userName, string password) return CheckSecurity(userName, password, () => { var blog = _blogContext.Blog; - var post = _blogManager.GetPost(blog.Id, p => p.PostId == postId); + var post = _blogManager.GetPost(blog.BlogId, p => p.PostId == postId); return new XmlRpcResult(post.ToXmlRpcPost()); }); diff --git a/src/Naif.Blog.Core/Models/Blog.cs b/src/Naif.Blog.Core/Models/Blog.cs index d7b92a7..41b5762 100644 --- a/src/Naif.Blog.Core/Models/Blog.cs +++ b/src/Naif.Blog.Core/Models/Blog.cs @@ -1,10 +1,12 @@ using System; -using System.Collections; using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable UnusedAutoPropertyAccessor.Global +// ReSharper disable ClassNeverInstantiated.Global + namespace Naif.Blog.Models { public class Blog @@ -15,7 +17,7 @@ public Blog() Disclaimer = String.Empty; GoogleAnalytics = String.Empty; HomeRedirectUrl = String.Empty; - Id = String.Empty; + BlogId = String.Empty; LocalUrl = String.Empty; OwnerId = -1; Theme = String.Empty; @@ -23,7 +25,7 @@ public Blog() Url = String.Empty; } - public string Id { get; set; } + public string BlogId { get; set; } public string ByLine { get; set; } diff --git a/src/Naif.Blog.Core/Models/Category.cs b/src/Naif.Blog.Core/Models/Category.cs index 051b380..476386d 100644 --- a/src/Naif.Blog.Core/Models/Category.cs +++ b/src/Naif.Blog.Core/Models/Category.cs @@ -1,5 +1,10 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; + +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable UnusedAutoPropertyAccessor.Global +// ReSharper disable PropertyCanBeMadeInitOnly.Global namespace Naif.Blog.Models { @@ -20,8 +25,11 @@ public Category() public string Name { get; set; } + [NotMapped] public int Count { get; set; } + //Relationships + public Blog Blog { get; set; } public IList Posts { get; set; } diff --git a/src/Naif.Blog.Core/Models/Post.cs b/src/Naif.Blog.Core/Models/Post.cs index 0a27202..53ba683 100644 --- a/src/Naif.Blog.Core/Models/Post.cs +++ b/src/Naif.Blog.Core/Models/Post.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using Naif.Blog.XmlRpc; -using Newtonsoft.Json; // ReSharper disable MemberCanBePrivate.Global // ReSharper disable UnusedAutoPropertyAccessor.Global diff --git a/src/Naif.Blog.Core/Models/Tag.cs b/src/Naif.Blog.Core/Models/Tag.cs index 2964137..ae47ea2 100644 --- a/src/Naif.Blog.Core/Models/Tag.cs +++ b/src/Naif.Blog.Core/Models/Tag.cs @@ -1,5 +1,11 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; + +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable UnusedAutoPropertyAccessor.Global +// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global +// ReSharper disable PropertyCanBeMadeInitOnly.Global namespace Naif.Blog.Models { @@ -10,14 +16,18 @@ public Tag() TagId = -1; Name = String.Empty; Posts = new List(); + Count = 0; } public int TagId { get; set; } public string Name { get; set; } + [NotMapped] public int Count { get; set; } + //Relationships + public Blog Blog { get; set; } public IList Posts { get; set; } diff --git a/src/Naif.Blog.Core/Naif.Blog.Core.csproj b/src/Naif.Blog.Core/Naif.Blog.Core.csproj index 22c8550..9b86293 100644 --- a/src/Naif.Blog.Core/Naif.Blog.Core.csproj +++ b/src/Naif.Blog.Core/Naif.Blog.Core.csproj @@ -4,14 +4,14 @@ net5.0 Naif.Blog 3.0.0 - 3.0.0.7 + 3.0.0.8 $(MSBuildProjectName).nuspec - + diff --git a/src/Naif.Blog.Core/Naif.Blog.Core.nuspec b/src/Naif.Blog.Core/Naif.Blog.Core.nuspec index 06bf612..dd8d489 100644 --- a/src/Naif.Blog.Core/Naif.Blog.Core.nuspec +++ b/src/Naif.Blog.Core/Naif.Blog.Core.nuspec @@ -2,7 +2,7 @@ Naif.Blog.Core - 3.0.0-beta.4 + 3.0.0 Charles Nurse Naif.Blog.Core This package contains core blogging components for use in the Naif.Blog family of projects @@ -16,7 +16,7 @@ - +