From 794831699de7f6119e705bf51964e742fad31167 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Wed, 15 May 2024 17:11:56 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B0=D0=BA=D0=B5=D1=82=D0=BD=D0=BE?= =?UTF-8?q?=D0=B5=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BE=D0=BF=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D0=B9=20=D0=BF=D0=BE?= =?UTF-8?q?=20=D1=81=D0=BA=D0=B2=D0=B0=D0=B6=D0=B8=D0=BD=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/WellOperationController.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/AsbCloudWebApi/Controllers/WellOperationController.cs b/AsbCloudWebApi/Controllers/WellOperationController.cs index 245b1f17..e3f361a7 100644 --- a/AsbCloudWebApi/Controllers/WellOperationController.cs +++ b/AsbCloudWebApi/Controllers/WellOperationController.cs @@ -250,6 +250,29 @@ public class WellOperationController : ControllerBase return Ok(result); } + /// + /// Удаляет выбранные операции по скважине + /// + /// id скважины + /// ids выбранных операций + /// Токен отмены задачи + /// Количество удаленных из БД строк + [HttpDelete] + [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public async Task DeleteRangeAsync([FromRoute] int idWell, IEnumerable ids, CancellationToken token) + { + if (!await CanUserAccessToWellAsync(idWell, token)) + return Forbid(); + + if (!await CanUserEditWellOperationsAsync(idWell, token)) + return Forbid(); + + var result = await wellOperationRepository.DeleteRangeAsync(ids, token); + + return Ok(result); + } + /// /// Формирование excel файла с операциями на скважине ///