Слой контрактов и моделей для клиентов

This commit is contained in:
Leozillo73 2024-04-27 18:47:12 +04:00
parent f9a38dd140
commit 07b8e098af
14 changed files with 237 additions and 5 deletions

View File

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

View File

@ -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();
}
}

View File

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

View File

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

View File

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

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

View File

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

View File

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

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

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

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

View File

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

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

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>