From 2b6e86ce12ed3edd249f08a47476db9e75d826ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=BA=20=D0=98=D0=B3=D0=BE=D1=80=D1=8C?= Date: Thu, 6 Apr 2023 22:06:49 +0400 Subject: [PATCH] =?UTF-8?q?=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=BD=D0=B5=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7?= =?UTF-8?q?=D1=83=D0=B5=D0=BC=D1=8B=D1=85=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4?= =?UTF-8?q?=D0=BE=D0=B2=20=D0=B2=20=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB=D1=8F?= =?UTF-8?q?=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CarService/CarServiceDatabase/Models/Customer.cs | 11 ----------- CarService/CarServiceDatabase/Models/Item.cs | 11 ----------- CarService/CarServiceDatabase/Models/ItemForRepair.cs | 10 ---------- CarService/CarServiceDatabase/Models/RepairRequest.cs | 9 --------- CarService/CarServiceDatabase/Models/Vehicle.cs | 11 ----------- CarService/CarServiceDatabase/Models/Work.cs | 11 ----------- CarService/CarServiceDatabase/Models/WorkInRequest.cs | 11 ----------- CarService/CarServiceDatabase/Models/WorkPayment.cs | 10 ---------- 8 files changed, 84 deletions(-) diff --git a/CarService/CarServiceDatabase/Models/Customer.cs b/CarService/CarServiceDatabase/Models/Customer.cs index 07f0ea7..fcbae4c 100644 --- a/CarService/CarServiceDatabase/Models/Customer.cs +++ b/CarService/CarServiceDatabase/Models/Customer.cs @@ -37,17 +37,6 @@ namespace CarServiceDatabase.Models Surname = model.Surname }; } - public static Customer Create(CustomerViewModel model) - { - return new() - { - Id = model.Id, - Login = model.Login, - Password = model.Password, - Name = model.Name, - Surname = model.Surname - }; - } public void Update(CustomerBindingModel? model) { if (model == null) diff --git a/CarService/CarServiceDatabase/Models/Item.cs b/CarService/CarServiceDatabase/Models/Item.cs index ab47d4a..4d8c058 100644 --- a/CarService/CarServiceDatabase/Models/Item.cs +++ b/CarService/CarServiceDatabase/Models/Item.cs @@ -38,17 +38,6 @@ namespace CarServiceDatabase.Models Worker = context.Workers.First(x => x.Id == model.WorkerId) }; } - public static Item Create(CarServiceDbContext context, ItemViewModel model) - { - return new() - { - Id = model.Id, - Name = model.Name, - Price = model.Price, - Count = model.Count, - Worker = context.Workers.First(x => x.Id == model.WorkerId) - }; - } public void Update(CarServiceDbContext context, ItemBindingModel? model) { if (model == null) diff --git a/CarService/CarServiceDatabase/Models/ItemForRepair.cs b/CarService/CarServiceDatabase/Models/ItemForRepair.cs index ca7f44f..2fe70d7 100644 --- a/CarService/CarServiceDatabase/Models/ItemForRepair.cs +++ b/CarService/CarServiceDatabase/Models/ItemForRepair.cs @@ -30,16 +30,6 @@ namespace CarServiceDatabase.Models RepairRequest = context.RepairRequests.First(x => x.Id == model.RepairRequestId) }; } - public static ItemForRepair Create(CarServiceDbContext context, ItemForRepairViewModel model) - { - return new() - { - Id = model.Id, - Count = model.Count, - Item = context.Items.First(x => x.Id == model.ItemId), - RepairRequest = context.RepairRequests.First(x => x.Id == model.RepairRequestId) - }; - } public void Update(CarServiceDbContext context, ItemForRepairBindingModel? model) { if (model == null) diff --git a/CarService/CarServiceDatabase/Models/RepairRequest.cs b/CarService/CarServiceDatabase/Models/RepairRequest.cs index 4f47592..a65572f 100644 --- a/CarService/CarServiceDatabase/Models/RepairRequest.cs +++ b/CarService/CarServiceDatabase/Models/RepairRequest.cs @@ -37,15 +37,6 @@ namespace CarServiceDatabase.Models VehicleId = model.VehicleId }; } - public static RepairRequest Create(RepairRequestViewModel model) - { - return new() - { - Id = model.Id, - DateCreated = model.DateCreated, - VehicleId = model.VehicleId - }; - } public void Update(RepairRequestBindingModel? model) { if (model == null) diff --git a/CarService/CarServiceDatabase/Models/Vehicle.cs b/CarService/CarServiceDatabase/Models/Vehicle.cs index a9694be..76b7c1c 100644 --- a/CarService/CarServiceDatabase/Models/Vehicle.cs +++ b/CarService/CarServiceDatabase/Models/Vehicle.cs @@ -36,17 +36,6 @@ namespace CarServiceDatabase.Models CustomerId = model.CustomerId }; } - public static Vehicle Create(VehicleViewModel model) - { - return new() - { - Id = model.Id, - Name = model.Name, - Plate = model.Plate, - VIN = model.VIN, - CustomerId = model.CustomerId - }; - } public void Update(VehicleBindingModel? model) { if (model == null) diff --git a/CarService/CarServiceDatabase/Models/Work.cs b/CarService/CarServiceDatabase/Models/Work.cs index a19958d..a32215b 100644 --- a/CarService/CarServiceDatabase/Models/Work.cs +++ b/CarService/CarServiceDatabase/Models/Work.cs @@ -38,17 +38,6 @@ namespace CarServiceDatabase.Models Worker = context.Workers.First(x => x.Id == model.WorkerId) }; } - public static Work Create(CarServiceDbContext context, WorkViewModel model) - { - return new() - { - Id = model.Id, - Name = model.Name, - Price = model.Price, - Duration = model.Duration, - Worker = context.Workers.First(x => x.Id == model.WorkerId) - }; - } public void Update(CarServiceDbContext context, WorkBindingModel? model) { if (model == null) diff --git a/CarService/CarServiceDatabase/Models/WorkInRequest.cs b/CarService/CarServiceDatabase/Models/WorkInRequest.cs index 627fd0e..6e9f82e 100644 --- a/CarService/CarServiceDatabase/Models/WorkInRequest.cs +++ b/CarService/CarServiceDatabase/Models/WorkInRequest.cs @@ -39,17 +39,6 @@ namespace CarServiceDatabase.Models WorkId = model.WorkId }; } - public static WorkInRequest Create(WorkInRequestViewModel model) - { - return new() - { - Id = model.Id, - Count = model.Count, - Cost = model.Cost, - RepairRequestId = model.RepairRequestId, - WorkId = model.WorkId - }; - } public void Update(WorkInRequestBindingModel? model) { if (model == null) diff --git a/CarService/CarServiceDatabase/Models/WorkPayment.cs b/CarService/CarServiceDatabase/Models/WorkPayment.cs index cdde6c1..e47f8d1 100644 --- a/CarService/CarServiceDatabase/Models/WorkPayment.cs +++ b/CarService/CarServiceDatabase/Models/WorkPayment.cs @@ -31,16 +31,6 @@ namespace CarServiceDatabase.Models WorkInRequestId = model.WorkInRequestId }; } - public static WorkPayment Create(WorkPaymentViewModel model) - { - return new() - { - Id = model.Id, - DatePayment = model.DatePayment, - Sum = model.Sum, - WorkInRequestId = model.WorkInRequestId - }; - } public void Update(WorkPaymentBindingModel? model) { if (model == null)