From 44d0c40065c30c266a75246cf28ff16bdbabdbd1 Mon Sep 17 00:00:00 2001 From: goblinrf Date: Wed, 24 Apr 2024 18:57:21 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BC=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VetClinicDataBaseImplement/Implements/VisitStorage.cs | 2 +- VetClinic/VetClinicDataBaseImplement/Models/Visit.cs | 6 +++--- .../Models/{ServiceVisit.cs => VisitService.cs} | 2 +- VetClinic/VetClinicDataBaseImplement/VetClinicDatabase .cs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) rename VetClinic/VetClinicDataBaseImplement/Models/{ServiceVisit.cs => VisitService.cs} (94%) diff --git a/VetClinic/VetClinicDataBaseImplement/Implements/VisitStorage.cs b/VetClinic/VetClinicDataBaseImplement/Implements/VisitStorage.cs index 417bb8b..4ecbbf4 100644 --- a/VetClinic/VetClinicDataBaseImplement/Implements/VisitStorage.cs +++ b/VetClinic/VetClinicDataBaseImplement/Implements/VisitStorage.cs @@ -117,4 +117,4 @@ namespace VetClinicDataBaseImplement.Implements } } } -} + diff --git a/VetClinic/VetClinicDataBaseImplement/Models/Visit.cs b/VetClinic/VetClinicDataBaseImplement/Models/Visit.cs index 6516c87..e68a0a3 100644 --- a/VetClinic/VetClinicDataBaseImplement/Models/Visit.cs +++ b/VetClinic/VetClinicDataBaseImplement/Models/Visit.cs @@ -32,7 +32,7 @@ namespace VetClinicDataBaseImplement.Models public virtual List Animals { get; set; } = new(); [ForeignKey("VisitId")] - public virtual List Services { get; set; } = new(); + public virtual List Services { get; set; } = new(); public virtual Admin Admin { get; set; } @@ -77,7 +77,7 @@ namespace VetClinicDataBaseImplement.Models { Animal = context.Animals.First(y => y.Id == x.Key) }).ToList(), - Services = model.ServiceVisits.Select(x => new ServiceVisit + Services = model.ServiceVisits.Select(x => new VisitService { Service = context.Services.First(y => y.Id == x.Key) }).ToList(), @@ -136,7 +136,7 @@ namespace VetClinicDataBaseImplement.Models var visit = context.Visits.First(x => x.Id == Id); foreach (var pc in model.ServiceVisits) { - context.ServiceVisits.Add(new ServiceVisit + context.ServiceVisits.Add(new VisitService { Visit = visit, Service = context.Services.First(x => x.Id == pc.Key), diff --git a/VetClinic/VetClinicDataBaseImplement/Models/ServiceVisit.cs b/VetClinic/VetClinicDataBaseImplement/Models/VisitService.cs similarity index 94% rename from VetClinic/VetClinicDataBaseImplement/Models/ServiceVisit.cs rename to VetClinic/VetClinicDataBaseImplement/Models/VisitService.cs index 4d53dcc..7dd986d 100644 --- a/VetClinic/VetClinicDataBaseImplement/Models/ServiceVisit.cs +++ b/VetClinic/VetClinicDataBaseImplement/Models/VisitService.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace VetClinicDataBaseImplement.Models { - public class ServiceVisit + public class VisitService { public int Id { get; set; } [Required] diff --git a/VetClinic/VetClinicDataBaseImplement/VetClinicDatabase .cs b/VetClinic/VetClinicDataBaseImplement/VetClinicDatabase .cs index c490c60..e3aa818 100644 --- a/VetClinic/VetClinicDataBaseImplement/VetClinicDatabase .cs +++ b/VetClinic/VetClinicDataBaseImplement/VetClinicDatabase .cs @@ -18,7 +18,7 @@ namespace VetClinicDataBaseImplement public virtual DbSet Animals { set; get; } public virtual DbSet Admins { set; get; } public virtual DbSet VisitAnimals { set; get; } - public virtual DbSet ServiceVisits { set; get; } + public virtual DbSet ServiceVisits { set; get; } public virtual DbSet Visits { set; get; } public virtual DbSet Vaccinations { set; get; } public virtual DbSet Pharmacists { set; get; }