diff --git a/PARR.Core/Services/Shortcodes/ShortcodesService.cs b/PARR.Core/Services/Shortcodes/ShortcodesService.cs index 8ff84c7e..4a62ec97 100644 --- a/PARR.Core/Services/Shortcodes/ShortcodesService.cs +++ b/PARR.Core/Services/Shortcodes/ShortcodesService.cs @@ -163,7 +163,8 @@ namespace PARR.Core.Services.Shortcodes } // Сохранение в кэш (только если были изменения) - if (!string.IsNullOrEmpty(result) && result != str) + // Нельзя писать template.Id == Guid.Empty, так как id для новых шаблонов 0000-000-000000 и будет не верно реализован шорт-код + if (!string.IsNullOrEmpty(result) && result != str && template.Id != Guid.Empty) { var toCache = new ShortcodesResult { diff --git a/PARR.DAL/Repositories/TemplateRepository.cs b/PARR.DAL/Repositories/TemplateRepository.cs index 11b95ac3..4a81b015 100644 --- a/PARR.DAL/Repositories/TemplateRepository.cs +++ b/PARR.DAL/Repositories/TemplateRepository.cs @@ -161,17 +161,17 @@ namespace PARR.DAL.Repositories var reservedTemplateId = result.FirstOrDefault(); - if (reservedTemplateId != default(Guid)) + if (reservedTemplateId != Guid.Empty) { logger.LogInformation("Успешно зарезервирован шаблон с ID: {TemplateId} для UnitId: {UnitId}", reservedTemplateId, newUnitId); + return reservedTemplateId; } else { logger.LogDebug("Не удалось зарезервировать шаблон для UnitId: {UnitId} (не найдено подходящих конфигураций роботов)", newUnitId); + return null; } - - return reservedTemplateId; } catch (Exception ex) {