Исполнитель: Сделал контракты

This commit is contained in:
Yunusov_Niyaz 2024-04-23 21:04:55 +04:00
parent d46b0214e7
commit 4bfeda8f0d
23 changed files with 289 additions and 10 deletions

View File

@ -0,0 +1,12 @@
using VeterinaryDataModels;
namespace VeterinaryContracts.BindingModels
{
public class OwnerBindingModel : IOwnerModel
{
public int Id { get; set; }
public string OwnerFIO { get; set; } = string.Empty;
public string Login { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,15 @@
using VeterinaryDataModels;
namespace VeterinaryContracts.BindingModels
{
public class PetBindingModel : IPetModel
{
public int Id { get; set; }
public int OwnerId { get; set; }
public string PetName { get; set; } = string.Empty;
public string PetType { get; set;} = string.Empty;
public string PetBreed { get; set; } = string.Empty;
public string PetGender { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,14 @@
using VeterinaryDataModels;
namespace VeterinaryContracts.BindingModels
{
public class PurchaseBindingModel : IPurchaseModel
{
public int Id { get; set; }
public int OwnerId { get; set; }
public int DrugId { get; set; }
public int Count { get; set; }
public DateTime DatePurchase { get; set; }
public Dictionary<int, (IPetModel, int)> PurchasePet { get; set; } = new();
}
}

View File

@ -0,0 +1,13 @@
using VeterinaryDataModels;
namespace VeterinaryContracts.BindingModels
{
public class VisitBindingModel : IVisitModel
{
public int Id { get; set; }
public int OwnerId { get; set; }
public int? DoctorId { get; set; } = null;
public DateTime DateVisit { get; set; }
public Dictionary<int, (IPetModel, int)> VisitPet { get; set; } = new();
}
}

View File

@ -0,0 +1,16 @@
using VeterinaryContracts.BindingModels;
using VeterinaryContracts.SearchModels;
using VeterinaryContracts.ViewModels;
namespace VeterinaryContracts.BusinessLogicContracts
{
public interface IOwnerLogic
{
List<OwnerViewModel>? ReadList(OwnerSearchModel? model);
OwnerViewModel? ReadElement(OwnerSearchModel model);
bool Create(OwnerBindingModel model);
bool Update(OwnerBindingModel model);
bool Delete(OwnerBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using VeterinaryContracts.BindingModels;
using VeterinaryContracts.SearchModels;
using VeterinaryContracts.ViewModels;
namespace VeterinaryContracts.BusinessLogicContracts
{
public interface IPetLogic
{
List<PetViewModel>? ReadList(PetSearchModel? model);
PetViewModel? ReadElement(PetSearchModel model);
bool Create(PetBindingModel model);
bool Update(PetBindingModel model);
bool Delete(PetBindingModel model);
}
}

View File

@ -0,0 +1,13 @@
using VeterinaryContracts.BindingModels;
using VeterinaryContracts.SearchModels;
using VeterinaryContracts.ViewModels;
namespace VeterinaryContracts.BusinessLogicContracts
{
public interface IPurchaseLogic
{
List<PurchaseViewModel>? ReadList(PurchaseSearchModel? model);
PurchaseViewModel? ReadElement(PurchaseSearchModel model);
bool CreateOrder(PurchaseBindingModel model);
}
}

View File

@ -0,0 +1,13 @@
using VeterinaryContracts.BindingModels;
using VeterinaryContracts.SearchModels;
using VeterinaryContracts.ViewModels;
namespace VeterinaryContracts.BusinessLogicContracts
{
public interface IVisitLogic
{
List<VisitViewModel>? ReadList(VisitSearchModel? model);
VisitViewModel? ReadElement(VisitSearchModel model);
bool CreateVisit(VisitBindingModel model);
}
}

View File

@ -0,0 +1,10 @@
namespace VeterinaryContracts.SearchModels
{
public class OwnerSearchModel
{
public int? Id { get; set; }
public string? OwnerFIO { get; set; }
public string? Login { get; set; }
public string? Password { get; set; }
}
}

View File

@ -0,0 +1,8 @@
namespace VeterinaryContracts.SearchModels
{
public class PetSearchModel
{
public int? Id { get; set; }
public string? PetName { get; set; }
}
}

View File

@ -0,0 +1,10 @@
namespace VeterinaryContracts.SearchModels
{
public class PurchaseSearchModel
{
public int? Id { get; set; }
public int? OwnerId { get; set; }
public int? DrugId { get; set; }
public DateTime? DatePurchase { get; set; }
}
}

View File

@ -0,0 +1,10 @@
namespace VeterinaryContracts.SearchModels
{
public class VisitSearchModel
{
public int? Id { get; set; }
public int? OwnerId { get; set; }
public int? DoctorId { get; set; }
public DateTime? DateVisit { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using VeterinaryContracts.BindingModels;
using VeterinaryContracts.SearchModels;
using VeterinaryContracts.ViewModels;
namespace VeterinaryContracts.StorageContracts
{
public interface IOwnerStorage
{
List<OwnerViewModel> GetFullList();
List<OwnerViewModel> GetFilteredList(OwnerSearchModel model);
OwnerViewModel? GetElement(OwnerSearchModel model);
OwnerViewModel? Insert(OwnerBindingModel model);
OwnerViewModel? Update(OwnerBindingModel model);
OwnerViewModel? Delete(OwnerBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using VeterinaryContracts.BindingModels;
using VeterinaryContracts.SearchModels;
using VeterinaryContracts.ViewModels;
namespace VeterinaryContracts.StorageContracts
{
public interface IPetStorage
{
List<PetViewModel> GetFullList();
List<PetViewModel> GetFilteredList(PetSearchModel model);
PetViewModel? GetElement(PetSearchModel model);
PetViewModel? Insert(PetBindingModel model);
PetViewModel? Update(PetBindingModel model);
PetViewModel? Delete(PetBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using VeterinaryContracts.BindingModels;
using VeterinaryContracts.SearchModels;
using VeterinaryContracts.ViewModels;
namespace VeterinaryContracts.StorageContracts
{
public interface IPurchaseStorage
{
List<PurchaseViewModel> GetFullList();
List<PurchaseViewModel> GetFilteredList(PurchaseSearchModel model);
PurchaseViewModel? GetElement(PurchaseSearchModel model);
PurchaseViewModel? Insert(PurchaseBindingModel model);
PurchaseViewModel? Update(PurchaseBindingModel model);
PurchaseViewModel? Delete(PurchaseBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using VeterinaryContracts.BindingModels;
using VeterinaryContracts.SearchModels;
using VeterinaryContracts.ViewModels;
namespace VeterinaryContracts.StorageContracts
{
public interface IVisitStorage
{
List<VisitViewModel> GetFullList();
List<VisitViewModel> GetFilteredList(VisitSearchModel model);
VisitViewModel? GetElement(VisitSearchModel model);
VisitViewModel? Insert(VisitBindingModel model);
VisitViewModel? Update(VisitBindingModel model);
VisitViewModel? Delete(VisitBindingModel model);
}
}

View File

@ -6,14 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Folder Include="BindingModels\" />
<Folder Include="StorageContracts\" />
<Folder Include="SearchModels\" />
<Folder Include="ViewModels\" />
<Folder Include="BusinessLogicContracts\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VeterinaryDataModels\VeterinaryDataModels.csproj" />
</ItemGroup>

View File

@ -0,0 +1,16 @@
using System.ComponentModel;
using VeterinaryDataModels;
namespace VeterinaryContracts.ViewModels
{
public class OwnerViewModel : IOwnerModel
{
public int Id { get; set; }
[DisplayName("ФИО хозяина")]
public string OwnerFIO { get; set; } = string.Empty;
[DisplayName("Логин (эл. почта)")]
public string Login { get; set; } = string.Empty;
[DisplayName("Пароль")]
public string Password { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,20 @@
using System.ComponentModel;
using VeterinaryDataModels;
namespace VeterinaryContracts.ViewModels
{
public class PetViewModel : IPetModel
{
public int Id { get; set; }
[DisplayName("Хозяин")]
public int OwnerId { get; set; }
[DisplayName("Кличка")]
public string PetName { get; set; } = string.Empty;
[DisplayName("Вид")]
public string PetType { get; set; } = string.Empty;
[DisplayName("Порода")]
public string PetBreed { get; set; } = string.Empty;
[DisplayName("Пол")]
public string PetGender { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,19 @@
using System.ComponentModel;
using VeterinaryDataModels;
namespace VeterinaryContracts.ViewModels
{
public class PurchaseViewModel : IPurchaseModel
{
public int Id { get; set; }
[DisplayName("Хозяин")]
public int OwnerId { get; set; }
[DisplayName("Лекарство")]
public int DrugId { get; set; }
[DisplayName("Количество")]
public int Count { get; set; }
[DisplayName("Дата покупки")]
public DateTime DatePurchase { get; set; }
public Dictionary<int, (IPetModel, int)> PurchasePet { get; set; } = new();
}
}

View File

@ -0,0 +1,17 @@
using System.ComponentModel;
using VeterinaryDataModels;
namespace VeterinaryContracts.ViewModels
{
public class VisitViewModel : IVisitModel
{
public int Id { get; set; }
[DisplayName("Хозяин")]
public int OwnerId { get; set; }
[DisplayName("Врач")]
public int? DoctorId { get; set; } = null;
[DisplayName("Дата посещения")]
public DateTime DateVisit { get; set; }
public Dictionary<int, (IPetModel, int)> VisitPet { get; set; } = new();
}
}

View File

@ -4,7 +4,8 @@
{
int OwnerId { get; }
int DrugId { get; }
string Count { get; }
int Count { get; }
DateTime DatePurchase { get; }
Dictionary<int, (IPetModel, int)> PurchasePet { get; }
}
}

View File

@ -3,7 +3,8 @@
public interface IVisitModel : IId
{
int OwnerId { get; }
int DoctorId { get; }
int? DoctorId { get; }
DateTime DateVisit { get; }
Dictionary<int, (IPetModel, int)> VisitPet { get; }
}
}