Модель + часть контрактов
This commit is contained in:
parent
97da529b74
commit
ddea13b484
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
20
BlogDataModels/BlogContracts/BindingModel/NewsBindinModel.cs
Normal file
20
BlogDataModels/BlogContracts/BindingModel/NewsBindinModel.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
19
BlogDataModels/BlogContracts/BindingModel/TagBindingModel.cs
Normal file
19
BlogDataModels/BlogContracts/BindingModel/TagBindingModel.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
18
BlogDataModels/BlogContracts/BlogContracts.csproj
Normal file
18
BlogDataModels/BlogContracts/BlogContracts.csproj
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="BusinessLogicContracts\" />
|
||||||
|
<Folder Include="StorageContracts\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\BlogDataModels\BlogDataModels.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
17
BlogDataModels/BlogContracts/SearchModels/NewsSearchModel.cs
Normal file
17
BlogDataModels/BlogContracts/SearchModels/NewsSearchModel.cs
Normal file
@ -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; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
14
BlogDataModels/BlogContracts/SearchModels/TagSearchModel.cs
Normal file
14
BlogDataModels/BlogContracts/SearchModels/TagSearchModel.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
14
BlogDataModels/BlogContracts/SearchModels/UserSearchModel.cs
Normal file
14
BlogDataModels/BlogContracts/SearchModels/UserSearchModel.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
20
BlogDataModels/BlogContracts/ViewModels/CommentViewModel.cs
Normal file
20
BlogDataModels/BlogContracts/ViewModels/CommentViewModel.cs
Normal file
@ -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; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
22
BlogDataModels/BlogContracts/ViewModels/NewsViewModel.cs
Normal file
22
BlogDataModels/BlogContracts/ViewModels/NewsViewModel.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
20
BlogDataModels/BlogContracts/ViewModels/TagViewModel.cs
Normal file
20
BlogDataModels/BlogContracts/ViewModels/TagViewModel.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
21
BlogDataModels/BlogContracts/ViewModels/UserViewModel.cs
Normal file
21
BlogDataModels/BlogContracts/ViewModels/UserViewModel.cs
Normal file
@ -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);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
31
BlogDataModels/BlogDataModels.sln
Normal file
31
BlogDataModels/BlogDataModels.sln
Normal file
@ -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
|
9
BlogDataModels/BlogDataModels/BlogDataModels.csproj
Normal file
9
BlogDataModels/BlogDataModels/BlogDataModels.csproj
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
13
BlogDataModels/BlogDataModels/IId.cs
Normal file
13
BlogDataModels/BlogDataModels/IId.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
14
BlogDataModels/BlogDataModels/Model/IComment.cs
Normal file
14
BlogDataModels/BlogDataModels/Model/IComment.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
15
BlogDataModels/BlogDataModels/Model/INews.cs
Normal file
15
BlogDataModels/BlogDataModels/Model/INews.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
14
BlogDataModels/BlogDataModels/Model/ITag.cs
Normal file
14
BlogDataModels/BlogDataModels/Model/ITag.cs
Normal file
@ -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;}
|
||||||
|
}
|
||||||
|
}
|
14
BlogDataModels/BlogDataModels/Model/IUser.cs
Normal file
14
BlogDataModels/BlogDataModels/Model/IUser.cs
Normal file
@ -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;}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user