Модель + часть контрактов

This commit is contained in:
Ismailov_Rovshan 2023-05-06 23:22:41 +04:00
parent 97da529b74
commit ddea13b484
20 changed files with 346 additions and 0 deletions

View File

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

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

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

View File

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

View 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>

View File

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

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

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

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

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

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

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

View 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);
}
}

View 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

View File

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

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

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

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

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

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