Добавил пользователей, пакет логирования к проекту бизнес-логики

This commit is contained in:
ujijrujijr 2024-04-19 16:37:22 +04:00
parent c85123f1e3
commit 9d25188cf5
7 changed files with 127 additions and 0 deletions

View File

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

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

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

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

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

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

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