Добавил пользователей, пакет логирования к проекту бизнес-логики
This commit is contained in:
parent
c85123f1e3
commit
9d25188cf5
@ -6,8 +6,16 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\ComputerShopContracts\ComputerShopContracts.csproj" />
|
<ProjectReference Include="..\ComputerShopContracts\ComputerShopContracts.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="BusinessLogics\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
20
ComputerShopContracts/BindingModels/UserBindingModel.cs
Normal file
20
ComputerShopContracts/BindingModels/UserBindingModel.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using ComputerShopDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ComputerShopContracts.BindingModels
|
||||||
|
{
|
||||||
|
public class UserBindingModel : IUserModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
//!!!МБ НЕ НАДО string.Empty
|
||||||
|
public string Login { get; set; } = string.Empty;
|
||||||
|
//!!!МБ НЕ НАДО string.Empty
|
||||||
|
public string Password { get; set; } = string.Empty;
|
||||||
|
//!!!МБ НЕ НАДО string.Empty
|
||||||
|
public string Email { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
20
ComputerShopContracts/BusinessLogicContracts/IUserLogic.cs
Normal file
20
ComputerShopContracts/BusinessLogicContracts/IUserLogic.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using ComputerShopContracts.BindingModels;
|
||||||
|
using ComputerShopContracts.SearchModels;
|
||||||
|
using ComputerShopContracts.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ComputerShopContracts.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);
|
||||||
|
}
|
||||||
|
}
|
18
ComputerShopContracts/SearchModels/UserSearchModel.cs
Normal file
18
ComputerShopContracts/SearchModels/UserSearchModel.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ComputerShopContracts.SearchModels
|
||||||
|
{
|
||||||
|
public class UserSearchModel
|
||||||
|
{
|
||||||
|
public int? Id { get; set; }
|
||||||
|
public string? Login { get; set; }
|
||||||
|
|
||||||
|
//!!!ПОИСК ПО ПАРОЛЮ НЕ СТАЛ ДОБАВЛЯТЬ, ИБО СТРАННО
|
||||||
|
|
||||||
|
public string? Email { get; set; }
|
||||||
|
}
|
||||||
|
}
|
21
ComputerShopContracts/StorageContracts/IUserStorage.cs
Normal file
21
ComputerShopContracts/StorageContracts/IUserStorage.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using ComputerShopContracts.BindingModels;
|
||||||
|
using ComputerShopContracts.SearchModels;
|
||||||
|
using ComputerShopContracts.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ComputerShopContracts.StorageContracts
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
25
ComputerShopContracts/ViewModels/UserViewModel.cs
Normal file
25
ComputerShopContracts/ViewModels/UserViewModel.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ComputerShopContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class UserViewModel
|
||||||
|
{
|
||||||
|
//!!!МБ ТУТ НАДО DisplayName (НО ВРЯД ЛИ)
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
//!!!МБ ТУТ НЕ НУЖНЫ string.Empty
|
||||||
|
[DisplayName("Логин")]
|
||||||
|
public string Login { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Пароль")]
|
||||||
|
public string Password { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[DisplayName("Почта")]
|
||||||
|
public string Email { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
15
ComputerShopDataModels/Models/IUserModel.cs
Normal file
15
ComputerShopDataModels/Models/IUserModel.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ComputerShopDataModels.Models
|
||||||
|
{
|
||||||
|
public interface IUserModel : IId
|
||||||
|
{
|
||||||
|
string Login { get; }
|
||||||
|
string Password { get; }
|
||||||
|
string Email { get; }
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user