forked from ddrilling/AsbCloudServer
Валидация удаления операций
This commit is contained in:
parent
794831699d
commit
ae620038c7
@ -16,6 +16,7 @@ using AsbCloudApp.Requests.ExportOptions;
|
||||
using AsbCloudApp.Requests.ParserOptions;
|
||||
using AsbCloudDb.Model;
|
||||
using AsbCloudInfrastructure.Services.WellOperations.Factories;
|
||||
using System.Linq;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers;
|
||||
|
||||
@ -268,8 +269,14 @@ public class WellOperationController : ControllerBase
|
||||
if (!await CanUserEditWellOperationsAsync(idWell, token))
|
||||
return Forbid();
|
||||
|
||||
if (!ids.Any())
|
||||
return this.ValidationBadRequest(nameof(ids), "Пустой список операций");
|
||||
|
||||
var result = await wellOperationRepository.DeleteRangeAsync(ids, token);
|
||||
|
||||
if(result == ICrudRepository<WellOperationDto>.ErrorIdNotFound)
|
||||
return this.ValidationBadRequest(nameof(ids), "Минимум одна из операций не найдена в базе");
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user