diff --git a/BlogDataModels/BlogContracts/BindingModel/CategoryBindingModel.cs b/BlogDataModels/BlogContracts/BindingModel/CategoryBindingModel.cs new file mode 100644 index 0000000..f0f3649 --- /dev/null +++ b/BlogDataModels/BlogContracts/BindingModel/CategoryBindingModel.cs @@ -0,0 +1,16 @@ +using ForumDataModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.BindingModels +{ + public class CategoryBindingModel : ICategoryModel + { + public string Name { get; set; } = string.Empty; + + public int Id { get; set; } + } +} diff --git a/BlogDataModels/BlogContracts/BindingModel/MessageBindingModel.cs b/BlogDataModels/BlogContracts/BindingModel/MessageBindingModel.cs new file mode 100644 index 0000000..8351c66 --- /dev/null +++ b/BlogDataModels/BlogContracts/BindingModel/MessageBindingModel.cs @@ -0,0 +1,22 @@ +using ForumDataModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.BindingModels +{ + public class MessageBindingModel : IMessageModel + { + public string Text { get; set; } = string.Empty; + + public DateTime Date { get; set; } + + public int Id { get; set; } + + public int TopicId { get; set; } + + public int UserId { get; set; } + } +} diff --git a/BlogDataModels/BlogContracts/BindingModel/RoleBindingModel.cs b/BlogDataModels/BlogContracts/BindingModel/RoleBindingModel.cs new file mode 100644 index 0000000..dc9ec5f --- /dev/null +++ b/BlogDataModels/BlogContracts/BindingModel/RoleBindingModel.cs @@ -0,0 +1,16 @@ +using ForumDataModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.BindingModels +{ + public class RoleBindingModel : IRoleModel + { + public string Name { get; set; } = string.Empty; + + public int Id { get; set; } + } +} diff --git a/BlogDataModels/BlogContracts/BindingModel/TopicBindingModel.cs b/BlogDataModels/BlogContracts/BindingModel/TopicBindingModel.cs new file mode 100644 index 0000000..e2deb6d --- /dev/null +++ b/BlogDataModels/BlogContracts/BindingModel/TopicBindingModel.cs @@ -0,0 +1,18 @@ +using ForumDataModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.BindingModels +{ + public class TopicBindingModel : ITopicModel + { + public string Name { get; set; } = string.Empty; + + public int Id { get; set; } + + public int CategoryId { get; set; } + } +} diff --git a/BlogDataModels/BlogContracts/BindingModel/UserBindingModel.cs b/BlogDataModels/BlogContracts/BindingModel/UserBindingModel.cs new file mode 100644 index 0000000..c62881c --- /dev/null +++ b/BlogDataModels/BlogContracts/BindingModel/UserBindingModel.cs @@ -0,0 +1,24 @@ +using ForumDataModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.BindingModels +{ + public class UserBindingModel : IUserModel + { + public string Username { get; set; } = string.Empty; + + public string Email { get; set; } = string.Empty; + + public string Password { get; set; } = string.Empty; + + public DateTime RegistrationDate { get; set; } = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc); + + public int Id { get; set; } + + public int RoleId { get; set; } + } +} diff --git a/BlogDataModels/BlogContracts/BusinessLogicContracts/ICategoryLogic.cs b/BlogDataModels/BlogContracts/BusinessLogicContracts/ICategoryLogic.cs new file mode 100644 index 0000000..a2faa1a --- /dev/null +++ b/BlogDataModels/BlogContracts/BusinessLogicContracts/ICategoryLogic.cs @@ -0,0 +1,20 @@ +using ForumContracts.BindingModels; +using ForumContracts.SearchModels; +using ForumContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.BusinessLogicContracts +{ + public interface ICategoryLogic + { + List? ReadList(CategorySearchModel? model); + CategoryViewModel? ReadElement(CategorySearchModel model); + bool Create(CategoryBindingModel model); + bool Update(CategoryBindingModel model); + bool Delete(CategoryBindingModel model); + } +} diff --git a/BlogDataModels/BlogContracts/BusinessLogicContracts/IMessageLogic.cs b/BlogDataModels/BlogContracts/BusinessLogicContracts/IMessageLogic.cs new file mode 100644 index 0000000..1b642df --- /dev/null +++ b/BlogDataModels/BlogContracts/BusinessLogicContracts/IMessageLogic.cs @@ -0,0 +1,23 @@ +using ForumContracts.BindingModels; +using ForumContracts.SearchModels; +using ForumContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.BusinessLogicContracts +{ + public interface IMessageLogic + { + List? ReadList(MessageSearchModel? model); + MessageViewModel? ReadElement(MessageSearchModel model); + bool Create(MessageBindingModel model); + bool Update(MessageBindingModel model); + bool Delete(MessageBindingModel model); + public string TestInsertList(int num, List users, List topics); + string TestReadList(int num); + string TestJoinReadList(int num); + } +} diff --git a/BlogDataModels/BlogContracts/BusinessLogicContracts/IRoleLogic.cs b/BlogDataModels/BlogContracts/BusinessLogicContracts/IRoleLogic.cs new file mode 100644 index 0000000..b2596ad --- /dev/null +++ b/BlogDataModels/BlogContracts/BusinessLogicContracts/IRoleLogic.cs @@ -0,0 +1,21 @@ +using ForumContracts.BindingModels; +using ForumContracts.SearchModels; +using ForumContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.BusinessLogicContracts +{ + public interface IRoleLogic + { + List? ReadList(RoleSearchModel? model); + RoleViewModel? ReadElement(RoleSearchModel model); + bool Create(RoleBindingModel model); + bool Update(RoleBindingModel model); + bool Delete(RoleBindingModel model); + void RoleInsertList(int num); + } +} diff --git a/BlogDataModels/BlogContracts/BusinessLogicContracts/ITopicLogic.cs b/BlogDataModels/BlogContracts/BusinessLogicContracts/ITopicLogic.cs new file mode 100644 index 0000000..aeed54a --- /dev/null +++ b/BlogDataModels/BlogContracts/BusinessLogicContracts/ITopicLogic.cs @@ -0,0 +1,20 @@ +using ForumContracts.BindingModels; +using ForumContracts.SearchModels; +using ForumContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.BusinessLogicContracts +{ + public interface ITopicLogic + { + List? ReadList(TopicSearchModel? model); + TopicViewModel? ReadElement(TopicSearchModel model); + bool Create(TopicBindingModel model); + bool Update(TopicBindingModel model); + bool Delete(TopicBindingModel model); + } +} diff --git a/BlogDataModels/BlogContracts/BusinessLogicContracts/IUserLogic.cs b/BlogDataModels/BlogContracts/BusinessLogicContracts/IUserLogic.cs new file mode 100644 index 0000000..6d36dd2 --- /dev/null +++ b/BlogDataModels/BlogContracts/BusinessLogicContracts/IUserLogic.cs @@ -0,0 +1,21 @@ +using ForumContracts.BindingModels; +using ForumContracts.SearchModels; +using ForumContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.BusinessLogicContracts +{ + public interface IUserLogic + { + List? ReadList(UserSearchModel? model); + UserViewModel? ReadElement(UserSearchModel model); + bool Create(UserBindingModel model); + bool Update(UserBindingModel model); + bool Delete(UserBindingModel model); + void UserInsertList(int num, List roles); + } +} diff --git a/BlogDataModels/BlogContracts/SearchModels/CategorySearchModel.cs b/BlogDataModels/BlogContracts/SearchModels/CategorySearchModel.cs new file mode 100644 index 0000000..c5d556e --- /dev/null +++ b/BlogDataModels/BlogContracts/SearchModels/CategorySearchModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.SearchModels +{ + public class CategorySearchModel + { + public int? Id { get; set; } + public string? Name { get; set; } + } +} diff --git a/BlogDataModels/BlogContracts/SearchModels/MessageSearchModel.cs b/BlogDataModels/BlogContracts/SearchModels/MessageSearchModel.cs new file mode 100644 index 0000000..49cd0df --- /dev/null +++ b/BlogDataModels/BlogContracts/SearchModels/MessageSearchModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.SearchModels +{ + public class MessageSearchModel + { + public int? Id { get; set; } + public DateTime Date { get; set; } + } +} diff --git a/BlogDataModels/BlogContracts/SearchModels/RoleSearchModel.cs b/BlogDataModels/BlogContracts/SearchModels/RoleSearchModel.cs new file mode 100644 index 0000000..4a2f05a --- /dev/null +++ b/BlogDataModels/BlogContracts/SearchModels/RoleSearchModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.SearchModels +{ + public class RoleSearchModel + { + public int? Id { get; set; } + public string? Name { get; set; } + } +} diff --git a/BlogDataModels/BlogContracts/SearchModels/TopicSearchModel.cs b/BlogDataModels/BlogContracts/SearchModels/TopicSearchModel.cs new file mode 100644 index 0000000..a1700bd --- /dev/null +++ b/BlogDataModels/BlogContracts/SearchModels/TopicSearchModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.SearchModels +{ + public class TopicSearchModel + { + public int? Id { get; set; } + public string? Name { get; set; } + public int? CategoryId { get; set; } + } +} diff --git a/BlogDataModels/BlogContracts/SearchModels/UserSearchModel.cs b/BlogDataModels/BlogContracts/SearchModels/UserSearchModel.cs new file mode 100644 index 0000000..00f1e74 --- /dev/null +++ b/BlogDataModels/BlogContracts/SearchModels/UserSearchModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.SearchModels +{ + public class UserSearchModel + { + public int? Id { get; set; } + public string? Username { get; set; } + public string? Email { get; set; } + + } +} diff --git a/BlogDataModels/BlogContracts/StorageContracts/ICategoryStorage.cs b/BlogDataModels/BlogContracts/StorageContracts/ICategoryStorage.cs new file mode 100644 index 0000000..411d84b --- /dev/null +++ b/BlogDataModels/BlogContracts/StorageContracts/ICategoryStorage.cs @@ -0,0 +1,21 @@ +using ForumContracts.BindingModels; +using ForumContracts.SearchModels; +using ForumContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.StoragesContracts +{ + public interface ICategoryStorage + { + List GetFullList(); + List GetFilteredList(CategorySearchModel model); + CategoryViewModel? GetElement(CategorySearchModel model); + CategoryViewModel? Insert(CategoryBindingModel model); + CategoryViewModel? Update(CategoryBindingModel model); + CategoryViewModel? Delete(CategoryBindingModel model); + } +} diff --git a/BlogDataModels/BlogContracts/StorageContracts/IMessageStorage.cs b/BlogDataModels/BlogContracts/StorageContracts/IMessageStorage.cs new file mode 100644 index 0000000..9ad3261 --- /dev/null +++ b/BlogDataModels/BlogContracts/StorageContracts/IMessageStorage.cs @@ -0,0 +1,24 @@ +using ForumContracts.BindingModels; +using ForumContracts.SearchModels; +using ForumContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.StoragesContracts +{ + public interface IMessageStorage + { + List GetFullList(); + List GetFilteredList(MessageSearchModel model); + MessageViewModel? GetElement(MessageSearchModel model); + MessageViewModel? Insert(MessageBindingModel model); + MessageViewModel? Update(MessageBindingModel model); + MessageViewModel? Delete(MessageBindingModel model); + string TestInsertList(int num, List users, List topics); + string TestReadList(int num); + string TestJoinReadList(int num); + } +} diff --git a/BlogDataModels/BlogContracts/StorageContracts/IRoleStorage.cs b/BlogDataModels/BlogContracts/StorageContracts/IRoleStorage.cs new file mode 100644 index 0000000..4a98375 --- /dev/null +++ b/BlogDataModels/BlogContracts/StorageContracts/IRoleStorage.cs @@ -0,0 +1,22 @@ +using ForumContracts.BindingModels; +using ForumContracts.SearchModels; +using ForumContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.StoragesContracts +{ + public interface IRoleStorage + { + List GetFullList(); + List GetFilteredList(RoleSearchModel model); + RoleViewModel? GetElement(RoleSearchModel model); + RoleViewModel? Insert(RoleBindingModel model); + RoleViewModel? Update(RoleBindingModel model); + RoleViewModel? Delete(RoleBindingModel model); + void RoleInsertList(int num); + } +} diff --git a/BlogDataModels/BlogContracts/StorageContracts/ITopicStorage.cs b/BlogDataModels/BlogContracts/StorageContracts/ITopicStorage.cs new file mode 100644 index 0000000..0aeebc7 --- /dev/null +++ b/BlogDataModels/BlogContracts/StorageContracts/ITopicStorage.cs @@ -0,0 +1,21 @@ +using ForumContracts.BindingModels; +using ForumContracts.SearchModels; +using ForumContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.StoragesContracts +{ + public interface ITopicStorage + { + List GetFullList(); + List GetFilteredList(TopicSearchModel model); + TopicViewModel? GetElement(TopicSearchModel model); + TopicViewModel? Insert(TopicBindingModel model); + TopicViewModel? Update(TopicBindingModel model); + TopicViewModel? Delete(TopicBindingModel model); + } +} diff --git a/BlogDataModels/BlogContracts/StorageContracts/IUserStorage.cs b/BlogDataModels/BlogContracts/StorageContracts/IUserStorage.cs new file mode 100644 index 0000000..795d393 --- /dev/null +++ b/BlogDataModels/BlogContracts/StorageContracts/IUserStorage.cs @@ -0,0 +1,22 @@ +using ForumContracts.BindingModels; +using ForumContracts.SearchModels; +using ForumContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.StoragesContracts +{ + public interface IUserStorage + { + List GetFullList(); + List GetFilteredList(UserSearchModel model); + UserViewModel? GetElement(UserSearchModel model); + UserViewModel? Insert(UserBindingModel model); + UserViewModel? Update(UserBindingModel model); + UserViewModel? Delete(UserBindingModel model); + void UserInsertList(int num, List roles); + } +} diff --git a/BlogDataModels/BlogContracts/ViewModels/CategoryViewModel.cs b/BlogDataModels/BlogContracts/ViewModels/CategoryViewModel.cs new file mode 100644 index 0000000..7a9df09 --- /dev/null +++ b/BlogDataModels/BlogContracts/ViewModels/CategoryViewModel.cs @@ -0,0 +1,18 @@ +using ForumDataModels; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.ViewModels +{ + public class CategoryViewModel : ICategoryModel + { + [DisplayName("Название категории")] + public string Name { get; set; } = string.Empty; + + public int Id { get; set; } + } +} diff --git a/BlogDataModels/BlogContracts/ViewModels/MessageViewModel.cs b/BlogDataModels/BlogContracts/ViewModels/MessageViewModel.cs new file mode 100644 index 0000000..6f548b5 --- /dev/null +++ b/BlogDataModels/BlogContracts/ViewModels/MessageViewModel.cs @@ -0,0 +1,31 @@ +using ForumDataModels; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.ViewModels +{ + public class MessageViewModel : IMessageModel + { + public int UserId { get; set; } + + [DisplayName("Пользователь")] + public string Username { get; set; } = string.Empty; + + public int TopicId { get; set; } + + [DisplayName("Название темы")] + public string TopicName { get; set; } = string.Empty; + + [DisplayName("Текст сообщения")] + public string Text { get; set; } = string.Empty; + + [DisplayName("Дата написания сообщения")] + public DateTime Date { get; set; } + + public int Id { get; set; } + } +} diff --git a/BlogDataModels/BlogContracts/ViewModels/RoleViewModel.cs b/BlogDataModels/BlogContracts/ViewModels/RoleViewModel.cs new file mode 100644 index 0000000..5caa2de --- /dev/null +++ b/BlogDataModels/BlogContracts/ViewModels/RoleViewModel.cs @@ -0,0 +1,18 @@ +using ForumDataModels; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.ViewModels +{ + public class RoleViewModel : IRoleModel + { + [DisplayName("Название роли")] + public string Name { get; set; } = string.Empty; + + public int Id { get; set; } + } +} diff --git a/BlogDataModels/BlogContracts/ViewModels/TopicViewModel.cs b/BlogDataModels/BlogContracts/ViewModels/TopicViewModel.cs new file mode 100644 index 0000000..4266b24 --- /dev/null +++ b/BlogDataModels/BlogContracts/ViewModels/TopicViewModel.cs @@ -0,0 +1,20 @@ +using ForumDataModels; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.ViewModels +{ + public class TopicViewModel : ITopicModel + { + [DisplayName("Название темы")] + public string Name { get; set; } = string.Empty; + + public int Id { get; set; } + + public int CategoryId { get; set; } + } +} diff --git a/BlogDataModels/BlogContracts/ViewModels/UserViewModel.cs b/BlogDataModels/BlogContracts/ViewModels/UserViewModel.cs new file mode 100644 index 0000000..28ff39a --- /dev/null +++ b/BlogDataModels/BlogContracts/ViewModels/UserViewModel.cs @@ -0,0 +1,32 @@ +using ForumDataModels; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ForumContracts.ViewModels +{ + public class UserViewModel : IUserModel + { + [DisplayName("Имя")] + public string Username { get; set; } = string.Empty; + + [DisplayName("Почта")] + public string Email { get; set; } = string.Empty; + + [DisplayName("Пароль")] + public string Password { get; set; } = string.Empty; + + [DisplayName("Дата регистрации")] + public DateTime RegistrationDate { get; set; } + + public int Id { get; set; } + + public int RoleId { get; set; } + + [DisplayName("Роль")] + public string RoleName { get; set; } = string.Empty; + } +}