diff --git a/Sheaft.Core/Enums/MessageKind.cs b/Sheaft.Core/Enums/MessageKind.cs index 934e1fc27..6ca981a6c 100644 --- a/Sheaft.Core/Enums/MessageKind.cs +++ b/Sheaft.Core/Enums/MessageKind.cs @@ -288,5 +288,7 @@ public enum MessageKind Withholding_Cannot_Process_Pending = 106101, Withholding_Cannot_Process_Already_Succeeded = 106102, Withholding_Cannot_Process_Payout_No_Withholdings = 106103, + Catalogs = 107000, + Catalogs_CannotRemove_Consumers } } diff --git a/Sheaft.Localization/Resources/MessageResources.Designer.cs b/Sheaft.Localization/Resources/MessageResources.Designer.cs index 23c8a7d87..adb4db778 100644 --- a/Sheaft.Localization/Resources/MessageResources.Designer.cs +++ b/Sheaft.Localization/Resources/MessageResources.Designer.cs @@ -1676,5 +1676,17 @@ internal static string Unauthenticated { return ResourceManager.GetString("Unauthenticated", resourceCulture); } } + + internal static string Catalogs { + get { + return ResourceManager.GetString("Catalogs", resourceCulture); + } + } + + internal static string Catalogs_CannotRemove_Consumers { + get { + return ResourceManager.GetString("Catalogs_CannotRemove_Consumers", resourceCulture); + } + } } } diff --git a/Sheaft.Localization/Resources/MessageResources.resx b/Sheaft.Localization/Resources/MessageResources.resx index 550fb6767..893678e30 100644 --- a/Sheaft.Localization/Resources/MessageResources.resx +++ b/Sheaft.Localization/Resources/MessageResources.resx @@ -933,4 +933,10 @@ Vous devez être connecté pour accéder à cette ressource + + Catalogue + + + Impossible de supprimer un catalogue consommateur, vous pouvez néanmoins le désactiver. + \ No newline at end of file diff --git a/Sheaft.Mediatr/Catalog/Commands/DeleteCatalogCommand.cs b/Sheaft.Mediatr/Catalog/Commands/DeleteCatalogCommand.cs index 20b70ce92..55c5b744e 100644 --- a/Sheaft.Mediatr/Catalog/Commands/DeleteCatalogCommand.cs +++ b/Sheaft.Mediatr/Catalog/Commands/DeleteCatalogCommand.cs @@ -46,6 +46,9 @@ public async Task Handle(DeleteCatalogCommand request, CancellationToken await _context.Catalogs .SingleOrDefaultAsync(c => c.Id == request.CatalogId, token); + if (entity.Kind == CatalogKind.Consumers) + return Failure(MessageKind.Catalogs_CannotRemove_Consumers); + var agreements = await _context.Agreements .Where(a => a.Catalog != null && a.CatalogId == entity.Id) .ToListAsync(token);