diff --git a/CarService/CarServiceDatabase/Models/WorkInRequest.cs b/CarService/CarServiceDatabase/Models/WorkInRequest.cs index f484371..6cb636d 100644 --- a/CarService/CarServiceDatabase/Models/WorkInRequest.cs +++ b/CarService/CarServiceDatabase/Models/WorkInRequest.cs @@ -33,7 +33,7 @@ namespace CarServiceDatabase.Models return new() { Count = model.Count, - Cost = model.Cost, + Cost = context.Works.First(x => x.Id == model.WorkId).Price * model.Count, RepairRequestId = model.RepairRequestId, Work = context.Works.First(x => x.Id == model.WorkId) }; @@ -45,7 +45,7 @@ namespace CarServiceDatabase.Models return; } Count = model.Count; - Cost = model.Cost; + Cost = context.Works.First(x => x.Id == model.WorkId).Price * model.Count; RepairRequestId = model.RepairRequestId; Work = context.Works.First(x => x.Id == model.WorkId); }