From ddea13b4848c8c1c3aaa9bcde459a24b43b407d1 Mon Sep 17 00:00:00 2001 From: Ismailov_Rovshan Date: Sat, 6 May 2023 23:22:41 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=BE=D0=B4=D0=B5=D0=BB=D1=8C=20+=20?= =?UTF-8?q?=D1=87=D0=B0=D1=81=D1=82=D1=8C=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80?= =?UTF-8?q?=D0=B0=D0=BA=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BindingModel/CommentBindingModel.cs | 18 +++++++++++ .../BindingModel/NewsBindinModel.cs | 20 ++++++++++++ .../BindingModel/TagBindingModel.cs | 19 ++++++++++++ .../BindingModel/UserBindingModel.cs | 18 +++++++++++ .../BlogContracts/BlogContracts.csproj | 18 +++++++++++ .../SearchModels/CommentSearchModel.cs | 15 +++++++++ .../SearchModels/NewsSearchModel.cs | 17 ++++++++++ .../SearchModels/TagSearchModel.cs | 14 +++++++++ .../SearchModels/UserSearchModel.cs | 14 +++++++++ .../ViewModels/CommentViewModel.cs | 20 ++++++++++++ .../BlogContracts/ViewModels/NewsViewModel.cs | 22 +++++++++++++ .../BlogContracts/ViewModels/TagViewModel.cs | 20 ++++++++++++ .../BlogContracts/ViewModels/UserViewModel.cs | 21 +++++++++++++ BlogDataModels/BlogDataModels.sln | 31 +++++++++++++++++++ .../BlogDataModels/BlogDataModels.csproj | 9 ++++++ BlogDataModels/BlogDataModels/IId.cs | 13 ++++++++ .../BlogDataModels/Model/IComment.cs | 14 +++++++++ BlogDataModels/BlogDataModels/Model/INews.cs | 15 +++++++++ BlogDataModels/BlogDataModels/Model/ITag.cs | 14 +++++++++ BlogDataModels/BlogDataModels/Model/IUser.cs | 14 +++++++++ 20 files changed, 346 insertions(+) create mode 100644 BlogDataModels/BlogContracts/BindingModel/CommentBindingModel.cs create mode 100644 BlogDataModels/BlogContracts/BindingModel/NewsBindinModel.cs create mode 100644 BlogDataModels/BlogContracts/BindingModel/TagBindingModel.cs create mode 100644 BlogDataModels/BlogContracts/BindingModel/UserBindingModel.cs create mode 100644 BlogDataModels/BlogContracts/BlogContracts.csproj create mode 100644 BlogDataModels/BlogContracts/SearchModels/CommentSearchModel.cs create mode 100644 BlogDataModels/BlogContracts/SearchModels/NewsSearchModel.cs create mode 100644 BlogDataModels/BlogContracts/SearchModels/TagSearchModel.cs create mode 100644 BlogDataModels/BlogContracts/SearchModels/UserSearchModel.cs create mode 100644 BlogDataModels/BlogContracts/ViewModels/CommentViewModel.cs create mode 100644 BlogDataModels/BlogContracts/ViewModels/NewsViewModel.cs create mode 100644 BlogDataModels/BlogContracts/ViewModels/TagViewModel.cs create mode 100644 BlogDataModels/BlogContracts/ViewModels/UserViewModel.cs create mode 100644 BlogDataModels/BlogDataModels.sln create mode 100644 BlogDataModels/BlogDataModels/BlogDataModels.csproj create mode 100644 BlogDataModels/BlogDataModels/IId.cs create mode 100644 BlogDataModels/BlogDataModels/Model/IComment.cs create mode 100644 BlogDataModels/BlogDataModels/Model/INews.cs create mode 100644 BlogDataModels/BlogDataModels/Model/ITag.cs create mode 100644 BlogDataModels/BlogDataModels/Model/IUser.cs diff --git a/BlogDataModels/BlogContracts/BindingModel/CommentBindingModel.cs b/BlogDataModels/BlogContracts/BindingModel/CommentBindingModel.cs new file mode 100644 index 0000000..0981a5d --- /dev/null +++ b/BlogDataModels/BlogContracts/BindingModel/CommentBindingModel.cs @@ -0,0 +1,18 @@ +using BlogDataModels.Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BlogContracts.BindingModel +{ + public class CommentBindingModel : IComment + { + public string Text { get; set; } = string.Empty; + + public int NewId { get; set; } + + public int Id { get; set; } + } +} diff --git a/BlogDataModels/BlogContracts/BindingModel/NewsBindinModel.cs b/BlogDataModels/BlogContracts/BindingModel/NewsBindinModel.cs new file mode 100644 index 0000000..48b900d --- /dev/null +++ b/BlogDataModels/BlogContracts/BindingModel/NewsBindinModel.cs @@ -0,0 +1,20 @@ +using BlogDataModels.Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BlogContracts.BindingModel +{ + public class NewsBindinModel : INews + { + public string Title { get; set; } = string.Empty; + + public string Author { get; set; } = string.Empty; + + public int Id { get; set; } + + public string Text { get; set; } = string.Empty; + } +} diff --git a/BlogDataModels/BlogContracts/BindingModel/TagBindingModel.cs b/BlogDataModels/BlogContracts/BindingModel/TagBindingModel.cs new file mode 100644 index 0000000..ab59023 --- /dev/null +++ b/BlogDataModels/BlogContracts/BindingModel/TagBindingModel.cs @@ -0,0 +1,19 @@ +using BlogDataModels.Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; + +namespace BlogContracts.BindingModel +{ + public class TagBindingModel : ITag + { + public int NewId { get; set; } + + public int Id { get; set; } + + public string Name { get; set; } = string.Empty; + } +} diff --git a/BlogDataModels/BlogContracts/BindingModel/UserBindingModel.cs b/BlogDataModels/BlogContracts/BindingModel/UserBindingModel.cs new file mode 100644 index 0000000..b9c1461 --- /dev/null +++ b/BlogDataModels/BlogContracts/BindingModel/UserBindingModel.cs @@ -0,0 +1,18 @@ +using BlogDataModels.Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BlogContracts.BindingModel +{ + public class UserBindingModel : IUser + { + public string Name { get; set; } = string.Empty; + + public DateTime DateCreate { get; set; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc); + + public int Id { get; set; } + } +} diff --git a/BlogDataModels/BlogContracts/BlogContracts.csproj b/BlogDataModels/BlogContracts/BlogContracts.csproj new file mode 100644 index 0000000..7201d0b --- /dev/null +++ b/BlogDataModels/BlogContracts/BlogContracts.csproj @@ -0,0 +1,18 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + diff --git a/BlogDataModels/BlogContracts/SearchModels/CommentSearchModel.cs b/BlogDataModels/BlogContracts/SearchModels/CommentSearchModel.cs new file mode 100644 index 0000000..5584e7a --- /dev/null +++ b/BlogDataModels/BlogContracts/SearchModels/CommentSearchModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BlogContracts.SearchModels +{ + public class CommentSearchModel + { + public int? Id { get; set; } + public int? NewId { get; set; } + public string? Text { get; set; } + } +} diff --git a/BlogDataModels/BlogContracts/SearchModels/NewsSearchModel.cs b/BlogDataModels/BlogContracts/SearchModels/NewsSearchModel.cs new file mode 100644 index 0000000..1c42858 --- /dev/null +++ b/BlogDataModels/BlogContracts/SearchModels/NewsSearchModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BlogContracts.SearchModels +{ + public class NewsSearchModel + { + public int? Id { get; set; } + public string? Title { get; set; } + public string? Author { get; set; } + + + } +} diff --git a/BlogDataModels/BlogContracts/SearchModels/TagSearchModel.cs b/BlogDataModels/BlogContracts/SearchModels/TagSearchModel.cs new file mode 100644 index 0000000..52b63f2 --- /dev/null +++ b/BlogDataModels/BlogContracts/SearchModels/TagSearchModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BlogContracts.SearchModels +{ + public class TagSearchModel + { + public int? Id { get; set; } + public string? Name { get; set; } + } +} diff --git a/BlogDataModels/BlogContracts/SearchModels/UserSearchModel.cs b/BlogDataModels/BlogContracts/SearchModels/UserSearchModel.cs new file mode 100644 index 0000000..18efc81 --- /dev/null +++ b/BlogDataModels/BlogContracts/SearchModels/UserSearchModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BlogContracts.SearchModels +{ + public class UserSearchModel + { + public int? Id { get; set; } + public string? Name { get; set; } + } +} diff --git a/BlogDataModels/BlogContracts/ViewModels/CommentViewModel.cs b/BlogDataModels/BlogContracts/ViewModels/CommentViewModel.cs new file mode 100644 index 0000000..fd4ba90 --- /dev/null +++ b/BlogDataModels/BlogContracts/ViewModels/CommentViewModel.cs @@ -0,0 +1,20 @@ +using BlogDataModels.Model; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BlogContracts.ViewModels +{ + public class CommentViewModel : IComment + { + [DisplayName("Номер")] + public int Id { get; set; } + [DisplayName("Текст комментария")] + public string Text { get; set; } = string.Empty; + public int NewId { get; set; } + + } +} diff --git a/BlogDataModels/BlogContracts/ViewModels/NewsViewModel.cs b/BlogDataModels/BlogContracts/ViewModels/NewsViewModel.cs new file mode 100644 index 0000000..6ec5f09 --- /dev/null +++ b/BlogDataModels/BlogContracts/ViewModels/NewsViewModel.cs @@ -0,0 +1,22 @@ +using BlogDataModels.Model; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BlogContracts.ViewModels +{ + public class NewsViewModel : INews + { + [DisplayName("Название")] + public string Title { get; set; } = string.Empty; + [DisplayName("Автор")] + public string Author { get; set; } = string.Empty; + [DisplayName("Номер")] + public int Id { get; set; } + [DisplayName("Текст")] + public string Text { get; set; } = string.Empty; + } +} diff --git a/BlogDataModels/BlogContracts/ViewModels/TagViewModel.cs b/BlogDataModels/BlogContracts/ViewModels/TagViewModel.cs new file mode 100644 index 0000000..40c9dca --- /dev/null +++ b/BlogDataModels/BlogContracts/ViewModels/TagViewModel.cs @@ -0,0 +1,20 @@ +using BlogDataModels.Model; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BlogContracts.ViewModels +{ + public class TagViewModel : ITag + { + [DisplayName("Номер")] + public int Id { get; set; } + [DisplayName("Номер новости")] + public int NewId { get; set; } + [DisplayName("Название")] + public string Name { get; set; } = string.Empty; + } +} diff --git a/BlogDataModels/BlogContracts/ViewModels/UserViewModel.cs b/BlogDataModels/BlogContracts/ViewModels/UserViewModel.cs new file mode 100644 index 0000000..f2b6303 --- /dev/null +++ b/BlogDataModels/BlogContracts/ViewModels/UserViewModel.cs @@ -0,0 +1,21 @@ +using BlogDataModels.Model; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BlogContracts.ViewModels +{ + public class UserViewModel : IUser + { + [DisplayName("Номер")] + public int Id { get; set; } + [DisplayName("Имя пользователя")] + public string Name { get; set; } = string.Empty; + [DisplayName("Дата регистрации")] + public DateTime DateCreate { get; set; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc); + + } +} diff --git a/BlogDataModels/BlogDataModels.sln b/BlogDataModels/BlogDataModels.sln new file mode 100644 index 0000000..cf7ccf1 --- /dev/null +++ b/BlogDataModels/BlogDataModels.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32901.215 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlogDataModels", "BlogDataModels\BlogDataModels.csproj", "{1031D282-ADC7-45D1-B177-B249AF60741F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlogContracts", "BlogContracts\BlogContracts.csproj", "{52620CAE-C105-47B1-8F07-456DB17E87B1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1031D282-ADC7-45D1-B177-B249AF60741F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1031D282-ADC7-45D1-B177-B249AF60741F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1031D282-ADC7-45D1-B177-B249AF60741F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1031D282-ADC7-45D1-B177-B249AF60741F}.Release|Any CPU.Build.0 = Release|Any CPU + {52620CAE-C105-47B1-8F07-456DB17E87B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {52620CAE-C105-47B1-8F07-456DB17E87B1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {52620CAE-C105-47B1-8F07-456DB17E87B1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {52620CAE-C105-47B1-8F07-456DB17E87B1}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {80B88330-F51A-4949-950C-6D6CF80E23AA} + EndGlobalSection +EndGlobal diff --git a/BlogDataModels/BlogDataModels/BlogDataModels.csproj b/BlogDataModels/BlogDataModels/BlogDataModels.csproj new file mode 100644 index 0000000..132c02c --- /dev/null +++ b/BlogDataModels/BlogDataModels/BlogDataModels.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + + diff --git a/BlogDataModels/BlogDataModels/IId.cs b/BlogDataModels/BlogDataModels/IId.cs new file mode 100644 index 0000000..3cb15f2 --- /dev/null +++ b/BlogDataModels/BlogDataModels/IId.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BlogDataModels +{ + public interface IId + { + int Id { get; } + } +} diff --git a/BlogDataModels/BlogDataModels/Model/IComment.cs b/BlogDataModels/BlogDataModels/Model/IComment.cs new file mode 100644 index 0000000..ff29241 --- /dev/null +++ b/BlogDataModels/BlogDataModels/Model/IComment.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BlogDataModels.Model +{ + public interface IComment : IId + { + string Text { get; } + int NewId { get; } + } +} diff --git a/BlogDataModels/BlogDataModels/Model/INews.cs b/BlogDataModels/BlogDataModels/Model/INews.cs new file mode 100644 index 0000000..26afbf1 --- /dev/null +++ b/BlogDataModels/BlogDataModels/Model/INews.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BlogDataModels.Model +{ + public interface INews : IId + { + string Title { get; } + string Text { get; } + string Author { get; } + } +} diff --git a/BlogDataModels/BlogDataModels/Model/ITag.cs b/BlogDataModels/BlogDataModels/Model/ITag.cs new file mode 100644 index 0000000..827286f --- /dev/null +++ b/BlogDataModels/BlogDataModels/Model/ITag.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BlogDataModels.Model +{ + public interface ITag : IId + { + string Name { get;} + int NewId { get;} + } +} diff --git a/BlogDataModels/BlogDataModels/Model/IUser.cs b/BlogDataModels/BlogDataModels/Model/IUser.cs new file mode 100644 index 0000000..19e8b49 --- /dev/null +++ b/BlogDataModels/BlogDataModels/Model/IUser.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BlogDataModels.Model +{ + public interface IUser : IId + { + string Name { get;} + DateTime DateCreate { get;} + } +}