diff --git a/src/Blogifier.Admin/Interop/CommonJsInterop.cs b/src/Blogifier.Admin/Interop/CommonJsInterop.cs index b3e29b14c..2e388a2b8 100644 --- a/src/Blogifier.Admin/Interop/CommonJsInterop.cs +++ b/src/Blogifier.Admin/Interop/CommonJsInterop.cs @@ -5,12 +5,10 @@ namespace Blogifier.Admin.Interop; -public class CommonJsInterop : IAsyncDisposable +public class CommonJsInterop(IJSRuntime jsRuntime) : IAsyncDisposable { - private readonly Lazy> moduleTask; - - public CommonJsInterop(IJSRuntime jsRuntime) => - moduleTask = new(() => jsRuntime.InvokeAsync("import", "./admin/js/common.js").AsTask()); + private readonly Lazy> moduleTask = new(() => + jsRuntime.InvokeAsync("import", "./admin/js/common.js").AsTask()); public async ValueTask SetTooltipAsync() { diff --git a/src/Blogifier.Shared/Models/CategoryModel.cs b/src/Blogifier.Shared/Models/CategoryModel.cs index ff805d2b4..442167674 100644 --- a/src/Blogifier.Shared/Models/CategoryModel.cs +++ b/src/Blogifier.Shared/Models/CategoryModel.cs @@ -1,11 +1,6 @@ namespace Blogifier.Shared; -public class CategoryModel : PostPagerModel +public class CategoryModel(string category, PostPagerDto pager, MainDto main) : PostPagerModel(pager, main) { - public string Category { get; set; } - - public CategoryModel(string category, PostPagerDto pager, MainDto main) : base(pager, main) - { - Category = category; - } + public string Category { get; set; } = category; } diff --git a/src/Blogifier.Shared/Models/IndexModel.cs b/src/Blogifier.Shared/Models/IndexModel.cs index a4e691023..e5410b09c 100644 --- a/src/Blogifier.Shared/Models/IndexModel.cs +++ b/src/Blogifier.Shared/Models/IndexModel.cs @@ -1,9 +1,6 @@ using Blogifier.Shared; namespace Blogifier.Models; -public class IndexModel : PostPagerModel +public class IndexModel(PostPagerDto pager, MainDto main) : PostPagerModel(pager, main) { - public IndexModel(PostPagerDto pager, MainDto main) : base(pager, main) - { - } } diff --git a/src/Blogifier.Shared/Models/MainModel.cs b/src/Blogifier.Shared/Models/MainModel.cs index a64d6bc96..26ed1d176 100644 --- a/src/Blogifier.Shared/Models/MainModel.cs +++ b/src/Blogifier.Shared/Models/MainModel.cs @@ -1,11 +1,6 @@ namespace Blogifier.Shared; -public class MainModel +public class MainModel(MainDto main) { - public MainDto Main { get; set; } - - public MainModel(MainDto main) - { - Main = main; - } + public MainDto Main { get; set; } = main; } diff --git a/src/Blogifier.Shared/Models/PostModel.cs b/src/Blogifier.Shared/Models/PostModel.cs index af7c64ec6..904db7198 100644 --- a/src/Blogifier.Shared/Models/PostModel.cs +++ b/src/Blogifier.Shared/Models/PostModel.cs @@ -1,12 +1,7 @@ namespace Blogifier.Shared; -public class PostModel : MainModel +public class PostModel(PostSlugDto postSlug, string categoriesUrl, MainDto main) : MainModel(main) { - public PostModel(PostSlugDto postSlug, string categoriesUrl, MainDto main) : base(main) - { - PostSlug = postSlug; - CategoriesUrl = categoriesUrl; - } - public PostSlugDto PostSlug { get; set; } - public string CategoriesUrl { get; set; } + public PostSlugDto PostSlug { get; set; } = postSlug; + public string CategoriesUrl { get; set; } = categoriesUrl; } diff --git a/src/Blogifier.Shared/Models/PostPagerModel.cs b/src/Blogifier.Shared/Models/PostPagerModel.cs index 94aae711f..ee27e3548 100644 --- a/src/Blogifier.Shared/Models/PostPagerModel.cs +++ b/src/Blogifier.Shared/Models/PostPagerModel.cs @@ -1,10 +1,6 @@ namespace Blogifier.Shared; -public class PostPagerModel : MainModel +public class PostPagerModel(PostPagerDto pager, MainDto main) : MainModel(main) { - public PostPagerModel(PostPagerDto pager, MainDto main) : base(main) - { - Pager = pager; - } - public PostPagerDto Pager { get; } + public PostPagerDto Pager { get; } = pager; } diff --git a/src/Blogifier.Shared/Models/SearchModel.cs b/src/Blogifier.Shared/Models/SearchModel.cs index 633eef691..5d39d3714 100644 --- a/src/Blogifier.Shared/Models/SearchModel.cs +++ b/src/Blogifier.Shared/Models/SearchModel.cs @@ -1,8 +1,5 @@ namespace Blogifier.Shared; -public class SearchModel : PostPagerModel +public class SearchModel(PostPagerDto pager, MainDto main) : PostPagerModel(pager, main) { - public SearchModel(PostPagerDto pager, MainDto main) : base(pager, main) - { - } }