Skip to content

Commit

Permalink
Minor model property cleanup Up version to 3.0.0 ready for release
Browse files Browse the repository at this point in the history
  • Loading branch information
cnurse committed Sep 6, 2021
1 parent fe46914 commit cfbb5bd
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 17 deletions.
10 changes: 5 additions & 5 deletions src/Naif.Blog.Core/Controllers/MetaWeblogController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}
Expand All @@ -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);
}
Expand All @@ -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)
{
Expand Down Expand Up @@ -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());
});
Expand Down
10 changes: 6 additions & 4 deletions src/Naif.Blog.Core/Models/Blog.cs
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,15 +17,15 @@ 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;
Title = String.Empty;
Url = String.Empty;
}

public string Id { get; set; }
public string BlogId { get; set; }

public string ByLine { get; set; }

Expand Down
8 changes: 8 additions & 0 deletions src/Naif.Blog.Core/Models/Category.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -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<Post> Posts { get; set; }
Expand Down
4 changes: 0 additions & 4 deletions src/Naif.Blog.Core/Models/Post.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 10 additions & 0 deletions src/Naif.Blog.Core/Models/Tag.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -10,14 +16,18 @@ public Tag()
TagId = -1;
Name = String.Empty;
Posts = new List<Post>();
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<Post> Posts { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions src/Naif.Blog.Core/Naif.Blog.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>Naif.Blog</RootNamespace>
<ProductVersion>3.0.0</ProductVersion>
<FileVersion>3.0.0.7</FileVersion>
<FileVersion>3.0.0.8</FileVersion>
<NuspecFile>$(MSBuildProjectName).nuspec</NuspecFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="5.0.1" />
<PackageReference Include="Naif.Core" Version="3.2.0-alpha.1" />
<PackageReference Include="Naif.Core" Version="3.2.0" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/Naif.Blog.Core/Naif.Blog.Core.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Naif.Blog.Core</id>
<version>3.0.0-beta.4</version>
<version>3.0.0</version>
<authors>Charles Nurse</authors>
<title>Naif.Blog.Core</title>
<description>This package contains core blogging components for use in the Naif.Blog family of projects</description>
Expand All @@ -16,7 +16,7 @@
<group targetFramework="net5.0">
<dependency id="Microsoft.AspNetCore.Mvc" version="2.2.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" version="5.0.1" exclude="Build,Analyzers" />
<dependency id="Naif.Core" version="3.2.0-alpha.1" exclude="Build,Analyzers" />
<dependency id="Naif.Core" version="3.2.0" exclude="Build,Analyzers" />
</group>
</dependencies>
</metadata>
Expand Down

0 comments on commit cfbb5bd

Please sign in to comment.