diff --git a/VetClinic/VetClinicContracts/BindingModels/VisitBindingModel.cs b/VetClinic/VetClinicContracts/BindingModels/VisitBindingModel.cs new file mode 100644 index 0000000..ee25936 --- /dev/null +++ b/VetClinic/VetClinicContracts/BindingModels/VisitBindingModel.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using VetClinicDataModels.Models; + +namespace VetClinicContracts.BindingModels +{ + public class VisitBindingModel + { + public int Id { get; set; } + public int AdminId { get; set; } + public Dictionary VisitAnimals { get; set; } = new(); + + public Dictionary ServiceVisits { get; set; } = new (); + public string NameVisit { get; set; } = string.Empty; + public DateTime DateVisit { get; set; } + } +} diff --git a/VetClinic/VetClinicContracts/BusinessLogicsContracts/IVisitLogic.cs b/VetClinic/VetClinicContracts/BusinessLogicsContracts/IVisitLogic.cs new file mode 100644 index 0000000..1897008 --- /dev/null +++ b/VetClinic/VetClinicContracts/BusinessLogicsContracts/IVisitLogic.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using VetClinicContracts.BindingModels; +using VetClinicContracts.SearchModels; +using VetClinicContracts.ViewModels; + +namespace VetClinicContracts.BusinessLogicsContracts +{ + public interface IVisitLogic + { + List? ReadList(VisitSearchModel? model); + VisitViewModel? ReadElement(VisitSearchModel model); + bool Create(VisitBindingModel model); + bool Update(VisitBindingModel model); + bool Delete(VisitBindingModel model); + } +} diff --git a/VetClinic/VetClinicContracts/SearchModels/VisitSearchModel.cs b/VetClinic/VetClinicContracts/SearchModels/VisitSearchModel.cs new file mode 100644 index 0000000..2754ad9 --- /dev/null +++ b/VetClinic/VetClinicContracts/SearchModels/VisitSearchModel.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VetClinicContracts.SearchModels +{ + public class VisitSearchModel + { + public int? Id { get; set; } + + public int? AdminId { get; set; } + public string? NameVisit { get; set; } + public DateTime? DateFrom { get; set; } + public DateTime? DateTo { get; set; } + } +} diff --git a/VetClinic/VetClinicContracts/StoragesContracts/IVisitStorage.cs b/VetClinic/VetClinicContracts/StoragesContracts/IVisitStorage.cs new file mode 100644 index 0000000..d77be25 --- /dev/null +++ b/VetClinic/VetClinicContracts/StoragesContracts/IVisitStorage.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using VetClinicContracts.BindingModels; +using VetClinicContracts.SearchModels; +using VetClinicContracts.ViewModels; + +namespace VetClinicContracts.StoragesContracts +{ + public interface IVisitStorage + { + List GetFullList(); + List GetFilteredList(VisitSearchModel model); + VisitViewModel? GetElement(VisitSearchModel model); + VisitViewModel? Insert(VisitBindingModel model); + VisitViewModel? Update(VaccinationBindingModel model); + VisitViewModel? Delete(VisitBindingModel model); + } +} diff --git a/VetClinic/VetClinicContracts/ViewModels/VisitViewModel.cs b/VetClinic/VetClinicContracts/ViewModels/VisitViewModel.cs index ca0d817..73a1bab 100644 --- a/VetClinic/VetClinicContracts/ViewModels/VisitViewModel.cs +++ b/VetClinic/VetClinicContracts/ViewModels/VisitViewModel.cs @@ -14,18 +14,22 @@ namespace VetClinicContracts.ViewModels public int Id { get; set; } public int ServiceId { get; set; } public int AdminId { get; set; } - public int AnimalId { get; set; } [DisplayName("Животное")] public string AnimalName { get; set; } = string.Empty; - [DisplayName("Название")] + [DisplayName("Название визита")] public string NameVisit { get; set; } = string.Empty; [DisplayName("Админ")] public string AdminFIO { get; set; } = string.Empty; - [DisplayName("Дата визита")] + [DisplayName("Название услуг")] + public string ServiceName { get; set; } = string.Empty; + + [DisplayName("Дата визита")] public DateTime DateVisit { get; set; } - public List VisitAnimals { get; set; } = new(); + public Dictionary VisitAnimals { get; set; } = new(); + + public Dictionary ServiceVisits { get; set; } = new(); } } diff --git a/VetClinic/VetClinicDataBaseImplement/Models/ServiceVisit.cs b/VetClinic/VetClinicDataBaseImplement/Models/ServiceVisit.cs new file mode 100644 index 0000000..f871a86 --- /dev/null +++ b/VetClinic/VetClinicDataBaseImplement/Models/ServiceVisit.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VetClinicDataBaseImplement.Models +{ + public class ServiceVisit : + { + public int Id { get; set; } + [Required] + public int ServicelId { get; set; } + [Required] + public int VisitId { get; set; } + + public virtual Service Service { get; set; } = new(); + public virtual Visit Visit { get; set; } = new(); + } +} diff --git a/VetClinic/VetClinicDataBaseImplement/Models/Vaccination.cs b/VetClinic/VetClinicDataBaseImplement/Models/Vaccination.cs index 3b2a14a..9186a80 100644 --- a/VetClinic/VetClinicDataBaseImplement/Models/Vaccination.cs +++ b/VetClinic/VetClinicDataBaseImplement/Models/Vaccination.cs @@ -8,10 +8,11 @@ using static System.Net.Mime.MediaTypeNames; using static System.Runtime.InteropServices.JavaScript.JSType; using VetClinicContracts.BindingModels; using VetClinicContracts.ViewModels; +using VetClinicDataModels.Models; namespace VetClinicDataBaseImplement.Models { - public class Vaccination + public class Vaccination : IVaccinationModel { public int Id { get; private set; } [Required] diff --git a/VetClinic/VetClinicDataBaseImplement/Models/Visit.cs b/VetClinic/VetClinicDataBaseImplement/Models/Visit.cs index ea254d5..fb15682 100644 --- a/VetClinic/VetClinicDataBaseImplement/Models/Visit.cs +++ b/VetClinic/VetClinicDataBaseImplement/Models/Visit.cs @@ -16,5 +16,17 @@ namespace VetClinicDataBaseImplement.Models public class Visit : IVisitModel { public int Id { get; private set; } + + [Required] + public int AnimalId { get; private set; } + public virtual Animal Animal { get; private set; } + + public virtual Service Service { get; private set; } + [Required] + public string NameVisit { get; private set; } = string.Empty; + [Required] + public double CostVaccination { get; private set; } + [Required] + public DateTime? DateStamp { get; private set; } } } diff --git a/VetClinic/VetClinicDataModels/Models/IVaccinationModel.cs b/VetClinic/VetClinicDataModels/Models/IVaccinationModel.cs index e284af7..4067559 100644 --- a/VetClinic/VetClinicDataModels/Models/IVaccinationModel.cs +++ b/VetClinic/VetClinicDataModels/Models/IVaccinationModel.cs @@ -11,6 +11,6 @@ namespace VetClinicDataModels.Models int AnimalId { get; } string NameVaccination { get; } double CostVaccination { get; } - DateTime DateStamp { get; } + DateTime? DateStamp { get; } } } diff --git a/VetClinic/VetClinicDataModels/Models/IVisitModel.cs b/VetClinic/VetClinicDataModels/Models/IVisitModel.cs index c0c70a6..0c5d8e4 100644 --- a/VetClinic/VetClinicDataModels/Models/IVisitModel.cs +++ b/VetClinic/VetClinicDataModels/Models/IVisitModel.cs @@ -14,5 +14,7 @@ namespace VetClinicDataModels.Models string NameVisit { get;} DateTime DateVisit { get; } Dictionary VisitAnimals { get; } + + Dictionary ServiceVisits { get; } } } diff --git a/VetClinic/VetClinicRestApi/VetClinicRestApi.csproj b/VetClinic/VetClinicRestApi/VetClinicRestApi.csproj index 7a5241b..64d63a7 100644 --- a/VetClinic/VetClinicRestApi/VetClinicRestApi.csproj +++ b/VetClinic/VetClinicRestApi/VetClinicRestApi.csproj @@ -19,6 +19,7 @@ +