Слой контрактов и моделей для клиентов
This commit is contained in:
parent
f9a38dd140
commit
07b8e098af
@ -11,8 +11,7 @@ namespace ZooContracts.BindingModels
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string ClientFIO { get; set; }
|
||||
public string Mail { get; set; }
|
||||
public string RegistrationDate { get; set; }
|
||||
public string EMail { get; set; }
|
||||
public string Password { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZooDataModels.Models;
|
||||
using ZooDataModels.Enums;
|
||||
|
||||
namespace ZooContracts.BindingModels
|
||||
{
|
||||
public class RouteBindingModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
public string RouteName { get; set; } = string.Empty;
|
||||
public double RoutePrice { get; set; }
|
||||
public RouteStatus Status { get; set; } = RouteStatus.Неизвестен;
|
||||
public DateTime DateStart { get; set; }
|
||||
public DateTime DateFinish { get; set; }
|
||||
public Dictionary<int, (IPreserveModel, int)> Preserves
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZooContracts.BindingModels;
|
||||
using ZooContracts.SearchModels;
|
||||
using ZooContracts.ViewModels;
|
||||
|
||||
namespace ZooContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IClientLogic
|
||||
{
|
||||
List<ClientViewModel>? ReadList(ClientSearchModel? model);
|
||||
ClientViewModel? ReadElement(ClientSearchModel model);
|
||||
bool Create(ClientBindingModel model);
|
||||
bool Update(ClientBindingModel model);
|
||||
bool Delete(ClientBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZooContracts.BindingModels;
|
||||
using ZooContracts.SearchModels;
|
||||
using ZooContracts.ViewModels;
|
||||
|
||||
namespace ZooContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IRouteLogic
|
||||
{
|
||||
List<RouteViewModel>? ReadList(RouteSearchModel? model);
|
||||
RouteViewModel? ReadElement(RouteSearchModel model);
|
||||
bool Create(RouteBindingModel model);
|
||||
bool Update(RouteBindingModel model);
|
||||
bool Delete(RouteBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZooContracts.SearchModels
|
||||
{
|
||||
public class ClientSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
public string? ClientFIO { get; set; }
|
||||
|
||||
public string? Email { get; set; }
|
||||
|
||||
public string? Password { get; set; }
|
||||
}
|
||||
}
|
19
git/JurasicZoo/ZooContracts/SearchModels/RouteSearchModel.cs
Normal file
19
git/JurasicZoo/ZooContracts/SearchModels/RouteSearchModel.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZooDataModels.Enums;
|
||||
|
||||
namespace ZooContracts.SearchModels
|
||||
{
|
||||
public class RouteSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? RouteName { get; set; } = string.Empty;
|
||||
public double? RoutePrice { get; set; }
|
||||
public RouteStatus Status { get; set; } = RouteStatus.Неизвестен;
|
||||
public DateTime? DateStart { get; set; }
|
||||
public DateTime? DateFinish { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZooContracts.BindingModels;
|
||||
using ZooContracts.SearchModels;
|
||||
using ZooContracts.ViewModels;
|
||||
|
||||
namespace ZooContracts.StorageContracts
|
||||
{
|
||||
public interface IClientStorage
|
||||
{
|
||||
List<ClientViewModel> GetFullList();
|
||||
List<ClientViewModel> GetFilteredList(ClientSearchModel model);
|
||||
ClientViewModel? GetElement(ClientSearchModel model);
|
||||
ClientViewModel? Insert(ClientSearchModel model);
|
||||
ClientViewModel? Update(ClientSearchModel model);
|
||||
ClientViewModel? Delete(ClientSearchModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZooContracts.BindingModels;
|
||||
using ZooContracts.SearchModels;
|
||||
using ZooContracts.ViewModels;
|
||||
|
||||
namespace ZooContracts.StorageContracts
|
||||
{
|
||||
public interface IRouteStorage
|
||||
{
|
||||
List<RouteViewModel> GetFullList();
|
||||
List<RouteViewModel> GetFilteredList(RouteSearchModel model);
|
||||
RouteViewModel? GetElement(RouteSearchModel model);
|
||||
RouteViewModel? Insert(RouteSearchModel model);
|
||||
RouteViewModel? Update(RouteSearchModel model);
|
||||
RouteViewModel? Delete(RouteSearchModel model);
|
||||
}
|
||||
}
|
22
git/JurasicZoo/ZooContracts/ViewModels/ClientViewModel.cs
Normal file
22
git/JurasicZoo/ZooContracts/ViewModels/ClientViewModel.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZooDataModels.Models;
|
||||
|
||||
namespace ZooContracts.ViewModels
|
||||
{
|
||||
public class ClientViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("ФИО клиента")]
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
[DisplayName("Email клиента")]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
[DisplayName("Пароль клиента")]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
}
|
31
git/JurasicZoo/ZooContracts/ViewModels/RouteViewModel.cs
Normal file
31
git/JurasicZoo/ZooContracts/ViewModels/RouteViewModel.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZooDataModels.Enums;
|
||||
using ZooDataModels.Models;
|
||||
|
||||
|
||||
namespace ZooContracts.ViewModels
|
||||
{
|
||||
public class RouteViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Название маршрута")]
|
||||
public string RouteName { get; set; } = string.Empty;
|
||||
[DisplayName("Стоимость маршрута")]
|
||||
public double RoutePrice { get; set; }
|
||||
[DisplayName("Статус")]
|
||||
public RouteStatus Status { get; set; } = RouteStatus.Неизвестен;
|
||||
[DisplayName("Дата начала")]
|
||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||
[DisplayName("Дата окончания")]
|
||||
public Dictionary<int, (IPreserveModel, int)> Preserves
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new();
|
||||
}
|
||||
}
|
15
git/JurasicZoo/ZooDataModels/Enums/RouteStatus.cs
Normal file
15
git/JurasicZoo/ZooDataModels/Enums/RouteStatus.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZooDataModels.Enums
|
||||
{
|
||||
public enum RouteStatus
|
||||
{
|
||||
Неизвестен = -1,
|
||||
Принят = 0,
|
||||
Завершен =1
|
||||
}
|
||||
}
|
@ -9,8 +9,7 @@ namespace ZooDataModels.Models
|
||||
public interface IClientModel : IId
|
||||
{
|
||||
string ClientFIO { get; }
|
||||
string Mail { get; }
|
||||
string RegistrationDate { get; }
|
||||
string EMail { get; }
|
||||
string Password { get; }
|
||||
}
|
||||
}
|
||||
|
20
git/JurasicZoo/ZooDataModels/Models/IRouteModel.cs
Normal file
20
git/JurasicZoo/ZooDataModels/Models/IRouteModel.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZooDataModels.Enums;
|
||||
|
||||
namespace ZooDataModels.Models
|
||||
{
|
||||
public interface IRouteModel
|
||||
{
|
||||
int ClientId { get; }
|
||||
string RouteName { get; }
|
||||
double RoutePrice { get; }
|
||||
RouteStatus Status { get; }
|
||||
DateTime DateStart { get; }
|
||||
DateTime DateFinish { get; }
|
||||
Dictionary<int, (IPreserveModel, int)> Preserves{ get; }
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
|
Loading…
Reference in New Issue
Block a user