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;} + } +}