diff --git a/AsbCloudInfrastructure/Repository/WellOperationRepository.cs b/AsbCloudInfrastructure/Repository/WellOperationRepository.cs index 208e94ac..ea9a6975 100644 --- a/AsbCloudInfrastructure/Repository/WellOperationRepository.cs +++ b/AsbCloudInfrastructure/Repository/WellOperationRepository.cs @@ -383,12 +383,12 @@ public class WellOperationRepository : IWellOperationRepository new[] { nameof(wellOperationDtos) }); } - if (previousDateEnd > currentDateStart) - { - yield return new ValidationResult( - "Предыдущая операция не завершена", - new[] { nameof(wellOperationDtos) }); - } + //if (previousDateEnd > currentDateStart) + //{ + // yield return new ValidationResult( + // "Предыдущая операция не завершена", + // new[] { nameof(wellOperationDtos) }); + //} previous = current; } diff --git a/AsbCloudWebApi/Extentions.cs b/AsbCloudWebApi/Extentions.cs index 5659292c..7299fae5 100644 --- a/AsbCloudWebApi/Extentions.cs +++ b/AsbCloudWebApi/Extentions.cs @@ -70,8 +70,10 @@ namespace Microsoft.AspNetCore.Mvc public static BadRequestObjectResult ValidationBadRequest(this ControllerBase controller, IEnumerable validationResults) { var errors = validationResults - .SelectMany(e => e.MemberNames.Select(name=> new { name, e.ErrorMessage })) - .ToDictionary(e => e.name, e => new[] { e.ErrorMessage ?? string.Empty }); + .SelectMany(e => e.MemberNames.Select(name => new { name, e.ErrorMessage })) + .GroupBy(e => e.name) + .ToDictionary(e => e.Key, e => e.Select(el => el.ErrorMessage ?? string.Empty).ToArray()); + var problem = new ValidationProblemDetails(errors); return controller.BadRequest(problem); }