From 4bd0a835fce99f3f46071d72597fe91f47f14d40 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Thu, 25 Jan 2024 16:52:27 +0500 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=BE=20=D0=B2=D0=B0=D0=BB=D0=B8=D0=B4=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudWebApi/Controllers/WellOperationController.cs | 8 ++++---- AsbCloudWebApi/Extentions.cs | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/AsbCloudWebApi/Controllers/WellOperationController.cs b/AsbCloudWebApi/Controllers/WellOperationController.cs index 79c7d900..74d4e16f 100644 --- a/AsbCloudWebApi/Controllers/WellOperationController.cs +++ b/AsbCloudWebApi/Controllers/WellOperationController.cs @@ -237,8 +237,8 @@ namespace AsbCloudWebApi.Controllers wellOperation.IdUser = User.GetUserId(); wellOperation.IdType = idType; - var validationResult = awaitoperationRepository.ValidateWithDbAsync(new[] { wellOperation }, cancellationToken); - if(validationResult.Any()) + var validationResult = await operationRepository.ValidateWithDbAsync(new[] { wellOperation }, cancellationToken); + if (validationResult.Any()) return this.ValidationBadRequest(validationResult); var result = await operationRepository.InsertRangeAsync(new[] { wellOperation }, cancellationToken); @@ -292,7 +292,7 @@ namespace AsbCloudWebApi.Controllers } - var validationResult = Validate(wellOperations, deleteBeforeInsert, cancellationToken); + var validationResult = await Validate(wellOperations, deleteBeforeInsert, cancellationToken); if (validationResult.Any()) return this.ValidationBadRequest(validationResult); @@ -309,7 +309,7 @@ namespace AsbCloudWebApi.Controllers /// /// /// - private IEnumerable Validate(IEnumerable wellOperations, bool deleteBeforeInsert, CancellationToken cancellationToken) + private async Task> Validate(IEnumerable wellOperations, bool deleteBeforeInsert, CancellationToken cancellationToken) { if (deleteBeforeInsert) return operationRepository.Validate(wellOperations); diff --git a/AsbCloudWebApi/Extentions.cs b/AsbCloudWebApi/Extentions.cs index c064d2de..5659292c 100644 --- a/AsbCloudWebApi/Extentions.cs +++ b/AsbCloudWebApi/Extentions.cs @@ -65,8 +65,7 @@ namespace Microsoft.AspNetCore.Mvc /// /// /// - /// - /// + /// /// public static BadRequestObjectResult ValidationBadRequest(this ControllerBase controller, IEnumerable validationResults) {