Контракты
This commit is contained in:
parent
93f8b040ca
commit
289ed32187
@ -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; }
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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<CategoryViewModel>? ReadList(CategorySearchModel? model);
|
||||
CategoryViewModel? ReadElement(CategorySearchModel model);
|
||||
bool Create(CategoryBindingModel model);
|
||||
bool Update(CategoryBindingModel model);
|
||||
bool Delete(CategoryBindingModel model);
|
||||
}
|
||||
}
|
@ -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<MessageViewModel>? 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<UserViewModel> users, List<TopicViewModel> topics);
|
||||
string TestReadList(int num);
|
||||
string TestJoinReadList(int num);
|
||||
}
|
||||
}
|
@ -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<RoleViewModel>? ReadList(RoleSearchModel? model);
|
||||
RoleViewModel? ReadElement(RoleSearchModel model);
|
||||
bool Create(RoleBindingModel model);
|
||||
bool Update(RoleBindingModel model);
|
||||
bool Delete(RoleBindingModel model);
|
||||
void RoleInsertList(int num);
|
||||
}
|
||||
}
|
@ -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<TopicViewModel>? ReadList(TopicSearchModel? model);
|
||||
TopicViewModel? ReadElement(TopicSearchModel model);
|
||||
bool Create(TopicBindingModel model);
|
||||
bool Update(TopicBindingModel model);
|
||||
bool Delete(TopicBindingModel model);
|
||||
}
|
||||
}
|
@ -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<UserViewModel>? ReadList(UserSearchModel? model);
|
||||
UserViewModel? ReadElement(UserSearchModel model);
|
||||
bool Create(UserBindingModel model);
|
||||
bool Update(UserBindingModel model);
|
||||
bool Delete(UserBindingModel model);
|
||||
void UserInsertList(int num, List<RoleViewModel> roles);
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
14
BlogDataModels/BlogContracts/SearchModels/RoleSearchModel.cs
Normal file
14
BlogDataModels/BlogContracts/SearchModels/RoleSearchModel.cs
Normal file
@ -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; }
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
16
BlogDataModels/BlogContracts/SearchModels/UserSearchModel.cs
Normal file
16
BlogDataModels/BlogContracts/SearchModels/UserSearchModel.cs
Normal file
@ -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; }
|
||||
|
||||
}
|
||||
}
|
@ -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<CategoryViewModel> GetFullList();
|
||||
List<CategoryViewModel> GetFilteredList(CategorySearchModel model);
|
||||
CategoryViewModel? GetElement(CategorySearchModel model);
|
||||
CategoryViewModel? Insert(CategoryBindingModel model);
|
||||
CategoryViewModel? Update(CategoryBindingModel model);
|
||||
CategoryViewModel? Delete(CategoryBindingModel model);
|
||||
}
|
||||
}
|
@ -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<MessageViewModel> GetFullList();
|
||||
List<MessageViewModel> GetFilteredList(MessageSearchModel model);
|
||||
MessageViewModel? GetElement(MessageSearchModel model);
|
||||
MessageViewModel? Insert(MessageBindingModel model);
|
||||
MessageViewModel? Update(MessageBindingModel model);
|
||||
MessageViewModel? Delete(MessageBindingModel model);
|
||||
string TestInsertList(int num, List<UserViewModel> users, List<TopicViewModel> topics);
|
||||
string TestReadList(int num);
|
||||
string TestJoinReadList(int num);
|
||||
}
|
||||
}
|
@ -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<RoleViewModel> GetFullList();
|
||||
List<RoleViewModel> GetFilteredList(RoleSearchModel model);
|
||||
RoleViewModel? GetElement(RoleSearchModel model);
|
||||
RoleViewModel? Insert(RoleBindingModel model);
|
||||
RoleViewModel? Update(RoleBindingModel model);
|
||||
RoleViewModel? Delete(RoleBindingModel model);
|
||||
void RoleInsertList(int num);
|
||||
}
|
||||
}
|
@ -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<TopicViewModel> GetFullList();
|
||||
List<TopicViewModel> GetFilteredList(TopicSearchModel model);
|
||||
TopicViewModel? GetElement(TopicSearchModel model);
|
||||
TopicViewModel? Insert(TopicBindingModel model);
|
||||
TopicViewModel? Update(TopicBindingModel model);
|
||||
TopicViewModel? Delete(TopicBindingModel model);
|
||||
}
|
||||
}
|
@ -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<UserViewModel> GetFullList();
|
||||
List<UserViewModel> GetFilteredList(UserSearchModel model);
|
||||
UserViewModel? GetElement(UserSearchModel model);
|
||||
UserViewModel? Insert(UserBindingModel model);
|
||||
UserViewModel? Update(UserBindingModel model);
|
||||
UserViewModel? Delete(UserBindingModel model);
|
||||
void UserInsertList(int num, List<RoleViewModel> roles);
|
||||
}
|
||||
}
|
18
BlogDataModels/BlogContracts/ViewModels/CategoryViewModel.cs
Normal file
18
BlogDataModels/BlogContracts/ViewModels/CategoryViewModel.cs
Normal file
@ -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; }
|
||||
}
|
||||
}
|
31
BlogDataModels/BlogContracts/ViewModels/MessageViewModel.cs
Normal file
31
BlogDataModels/BlogContracts/ViewModels/MessageViewModel.cs
Normal file
@ -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; }
|
||||
}
|
||||
}
|
18
BlogDataModels/BlogContracts/ViewModels/RoleViewModel.cs
Normal file
18
BlogDataModels/BlogContracts/ViewModels/RoleViewModel.cs
Normal file
@ -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; }
|
||||
}
|
||||
}
|
20
BlogDataModels/BlogContracts/ViewModels/TopicViewModel.cs
Normal file
20
BlogDataModels/BlogContracts/ViewModels/TopicViewModel.cs
Normal file
@ -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; }
|
||||
}
|
||||
}
|
32
BlogDataModels/BlogContracts/ViewModels/UserViewModel.cs
Normal file
32
BlogDataModels/BlogContracts/ViewModels/UserViewModel.cs
Normal file
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user