From cc01f57125267e091b75c67992a3464920593d1a Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 2 May 2024 17:36:23 +0200 Subject: [PATCH] Refaktorisierung der Lokalisierung und DTO-Integration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Ersetzung von ITranslateService durch IStringLocalizer für verbesserte Lokalisierung. - Aktualisierung der DTO-Klassen entsprechend der neuesten Core.DTO-Struktur. - Integration der neuen Klassen Result und DataResult aus Core.DTO für standardisierte Serviceantworten. --- .../Contracts/IConfigService.cs | 5 +- .../Contracts/IEnvelopeReceiverService.cs | 15 ++- .../Contracts/IEnvelopeService.cs | 5 +- EnvelopeGenerator.Application/EnvelopeFlag.cs | 4 +- .../EnvelopeGenerator.Application.csproj | 17 ++- .../EnvelopeGeneratorExtensions.cs | 2 +- EnvelopeGenerator.Application/Key.cs | 17 +++ EnvelopeGenerator.Application/MessageKey.cs | 19 --- .../Resources/Resource.cs | 9 ++ .../Resources/Resource.de_DE.resx | 123 ++++++++++++++++++ .../Resources/Resource.en_US.resx | 123 ++++++++++++++++++ .../Resources/Resource.resx | 123 ++++++++++++++++++ .../Services/ConfigService.cs | 17 +-- .../DocumentReceiverElementService.cs | 7 +- .../Services/DocumentStatusService.cs | 7 +- .../Services/EmailOutService.cs | 5 +- .../Services/EmailTemplateService.cs | 7 +- .../Services/EnvelopeCertificateService.cs | 7 +- .../Services/EnvelopeDocumentService.cs | 5 +- .../Services/EnvelopeHistoryService.cs | 7 +- .../Services/EnvelopeReceiverService.cs | 90 +++++++------ .../Services/EnvelopeService.cs | 19 +-- .../Services/EnvelopeTypeService.cs | 7 +- .../Services/ReceiverService.cs | 7 +- .../Services/UserReceiverService.cs | 7 +- .../Controllers/HomeController.cs | 27 ++-- .../Test/TestEnvelopeReceiverController.cs | 2 +- .../Test/TestLocalizerController.cs | 19 +++ .../EnvelopeGenerator.Web.csproj | 4 +- EnvelopeGenerator.Web/Program.cs | 10 +- .../Views/Home/ShowEnvelope.cshtml | 4 +- .../Views/Shared/_CookieConsentPartial.cshtml | 2 +- 32 files changed, 572 insertions(+), 150 deletions(-) create mode 100644 EnvelopeGenerator.Application/Key.cs delete mode 100644 EnvelopeGenerator.Application/MessageKey.cs create mode 100644 EnvelopeGenerator.Application/Resources/Resource.cs create mode 100644 EnvelopeGenerator.Application/Resources/Resource.de_DE.resx create mode 100644 EnvelopeGenerator.Application/Resources/Resource.en_US.resx create mode 100644 EnvelopeGenerator.Application/Resources/Resource.resx create mode 100644 EnvelopeGenerator.Web/Controllers/Test/TestLocalizerController.cs diff --git a/EnvelopeGenerator.Application/Contracts/IConfigService.cs b/EnvelopeGenerator.Application/Contracts/IConfigService.cs index c3ca102a..713c4d30 100644 --- a/EnvelopeGenerator.Application/Contracts/IConfigService.cs +++ b/EnvelopeGenerator.Application/Contracts/IConfigService.cs @@ -1,4 +1,5 @@ using DigitalData.Core.Contracts.Application; +using DigitalData.Core.DTO; using EnvelopeGenerator.Application.DTOs; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; @@ -7,8 +8,8 @@ namespace EnvelopeGenerator.Application.Contracts { public interface IConfigService : IBasicCRUDService { - Task> ReadFirstAsync(); + Task> ReadFirstAsync(); - async Task> ReadDefaultAsync() => await ReadFirstAsync(); + async Task> ReadDefaultAsync() => await ReadFirstAsync(); } } \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Contracts/IEnvelopeReceiverService.cs b/EnvelopeGenerator.Application/Contracts/IEnvelopeReceiverService.cs index 59d9c595..cf55acbf 100644 --- a/EnvelopeGenerator.Application/Contracts/IEnvelopeReceiverService.cs +++ b/EnvelopeGenerator.Application/Contracts/IEnvelopeReceiverService.cs @@ -1,4 +1,5 @@ using DigitalData.Core.Contracts.Application; +using DigitalData.Core.DTO; using EnvelopeGenerator.Application.DTOs; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; @@ -8,18 +9,18 @@ namespace EnvelopeGenerator.Application.Contracts public interface IEnvelopeReceiverService : IBasicCRUDService { - Task>> ReadByUuidAsync(string uuid, bool withEnvelope = true, bool withReceiver = false); + Task>> ReadByUuidAsync(string uuid, bool withEnvelope = true, bool withReceiver = false); - Task>> ReadBySignatureAsync(string signature, bool withEnvelope = false, bool withReceiver = true); + Task>> ReadBySignatureAsync(string signature, bool withEnvelope = false, bool withReceiver = true); - Task> ReadByUuidSignatureAsync(string uuid, string signature, bool withEnvelope = true, bool withReceiver = true); + Task> ReadByUuidSignatureAsync(string uuid, string signature, bool withEnvelope = true, bool withReceiver = true); - Task> ReadByEnvelopeReceiverIdAsync(string envelopeReceiverId, bool withEnvelope = true, bool withReceiver = true); + Task> ReadByEnvelopeReceiverIdAsync(string envelopeReceiverId, bool withEnvelope = true, bool withReceiver = true); - Task> VerifyAccessCodeAsync(string uuid, string signature, string accessCode); + Task> VerifyAccessCodeAsync(string uuid, string signature, string accessCode); - Task> VerifyAccessCodeAsync(string envelopeReceiverId, string accessCode); + Task> VerifyAccessCodeAsync(string envelopeReceiverId, string accessCode); - Task> IsExisting(string envelopeReceiverId); + Task> IsExisting(string envelopeReceiverId); } } \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Contracts/IEnvelopeService.cs b/EnvelopeGenerator.Application/Contracts/IEnvelopeService.cs index 1c275258..0e845adf 100644 --- a/EnvelopeGenerator.Application/Contracts/IEnvelopeService.cs +++ b/EnvelopeGenerator.Application/Contracts/IEnvelopeService.cs @@ -1,4 +1,5 @@ using DigitalData.Core.Contracts.Application; +using DigitalData.Core.DTO; using EnvelopeGenerator.Application.DTOs; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; @@ -7,8 +8,8 @@ namespace EnvelopeGenerator.Application.Contracts { public interface IEnvelopeService : IBasicCRUDService { - Task>> ReadAllWithAsync(bool documents = false, bool envelopeReceivers = false, bool history = false, bool documentReceiverElement = false); + Task>> ReadAllWithAsync(bool documents = false, bool envelopeReceivers = false, bool history = false, bool documentReceiverElement = false); - Task> ReadByUuidAsync(string uuid, string? signature = null, bool withDocuments = false, bool withEnvelopeReceivers = false, bool withHistory = false, bool withDocumentReceiverElement = false, bool withUser = false, bool withAll = false); + Task> ReadByUuidAsync(string uuid, string? signature = null, bool withDocuments = false, bool withEnvelopeReceivers = false, bool withHistory = false, bool withDocumentReceiverElement = false, bool withUser = false, bool withAll = false); } } \ No newline at end of file diff --git a/EnvelopeGenerator.Application/EnvelopeFlag.cs b/EnvelopeGenerator.Application/EnvelopeFlag.cs index 705df692..e8d6350c 100644 --- a/EnvelopeGenerator.Application/EnvelopeFlag.cs +++ b/EnvelopeGenerator.Application/EnvelopeFlag.cs @@ -3,6 +3,8 @@ public enum EnvelopeFlag { EnvelopeOrReceiverNonexists, - NonDecodableEnvelopeReceiverId + NonDecodableEnvelopeReceiverId, + WrongEnvelopeReceiverId, + AccessCodeNull } } \ No newline at end of file diff --git a/EnvelopeGenerator.Application/EnvelopeGenerator.Application.csproj b/EnvelopeGenerator.Application/EnvelopeGenerator.Application.csproj index 8607f5a3..bc2066ed 100644 --- a/EnvelopeGenerator.Application/EnvelopeGenerator.Application.csproj +++ b/EnvelopeGenerator.Application/EnvelopeGenerator.Application.csproj @@ -1,4 +1,4 @@ - + net7.0 @@ -22,6 +22,9 @@ ..\..\WebCoreModules\DigitalData.Core.Application\bin\Debug\net7.0\DigitalData.Core.Contracts.dll + + ..\..\WebCoreModules\DigitalData.Core.Application\bin\Debug\net7.0\DigitalData.Core.DTO.dll + ..\..\WebUserManager\DigitalData.UserManager.Application\bin\Debug\net7.0\DigitalData.Core.Infrastructure.dll @@ -36,4 +39,16 @@ + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + diff --git a/EnvelopeGenerator.Application/EnvelopeGeneratorExtensions.cs b/EnvelopeGenerator.Application/EnvelopeGeneratorExtensions.cs index 43cf6390..1b31a55c 100644 --- a/EnvelopeGenerator.Application/EnvelopeGeneratorExtensions.cs +++ b/EnvelopeGenerator.Application/EnvelopeGeneratorExtensions.cs @@ -37,7 +37,7 @@ namespace EnvelopeGenerator.Application public static string ToTitle(this (string? UUID, string? Signature) envelopeReceiverTuple) { - return $"Envelope UUID: {envelopeReceiverTuple.UUID}\n Receiver Signature: {envelopeReceiverTuple.Signature}"; + return $"UUID is {envelopeReceiverTuple.UUID} and \n signature is {envelopeReceiverTuple.Signature}"; } } } \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Key.cs b/EnvelopeGenerator.Application/Key.cs new file mode 100644 index 00000000..c1cd165d --- /dev/null +++ b/EnvelopeGenerator.Application/Key.cs @@ -0,0 +1,17 @@ +namespace EnvelopeGenerator.Application +{ + public static class Key + { + public static readonly string EnvelopeNotFound = "EnvelopeNotFound"; + public static readonly string EnvelopeReceiverNotFound = "EnvelopeReceiverNotFound"; + public static readonly string AccessCodeNull = "AccessCodeNull"; + public static readonly string WrongAccessCode = "WrongAccessCode"; + public static readonly string DataIntegrityIssue = "DataIntegrityIssue"; + public static readonly string SecurityBreachOrDataIntegrity = "SecurityBreachOrDataIntegrity"; + public static readonly string PossibleDataIntegrityIssue = "PossibleDataIntegrityIssue"; + public static readonly string SecurityBreach = "SecurityBreach"; + public static readonly string PossibleSecurityBreach = "PossibleSecurityBreach"; + public static readonly string WrongEnvelopeReceiverId = "WrongEnvelopeReceiverId"; + public static readonly string EnvelopeOrReceiverNonexists = "EnvelopeOrReceiverNonexists"; + } +} \ No newline at end of file diff --git a/EnvelopeGenerator.Application/MessageKey.cs b/EnvelopeGenerator.Application/MessageKey.cs deleted file mode 100644 index 54469ef2..00000000 --- a/EnvelopeGenerator.Application/MessageKey.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace EnvelopeGenerator.Application -{ - public enum MessageKey - { - EnvelopeNotFound, - EnvelopeReceiverNotFound, - AccessCodeNull2Client, - AccessCodeNull2Logger, - WrongAccessCode, - DataIntegrityIssue, - SecurityBreachOrDataIntegrity, - PossibleDataIntegrityIssue, - SecurityBreach, - PossibleSecurityBreach, - WrongEnvelopeReceiverId2Client, //Do not leak information about the creation of the url. For example, the envelope you are looking for does not exist - WrongEnvelopeReceiverId2Logger, - EnvelopeOrReceiverNonexists - } -} \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Resources/Resource.cs b/EnvelopeGenerator.Application/Resources/Resource.cs new file mode 100644 index 00000000..8b7e50aa --- /dev/null +++ b/EnvelopeGenerator.Application/Resources/Resource.cs @@ -0,0 +1,9 @@ +namespace EnvelopeGenerator.Application.Resources +{ + /// + /// The place holder class for Resource.*.resx + /// + public class Resource + { + } +} diff --git a/EnvelopeGenerator.Application/Resources/Resource.de_DE.resx b/EnvelopeGenerator.Application/Resources/Resource.de_DE.resx new file mode 100644 index 00000000..cad038d8 --- /dev/null +++ b/EnvelopeGenerator.Application/Resources/Resource.de_DE.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Hallo!! + + \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Resources/Resource.en_US.resx b/EnvelopeGenerator.Application/Resources/Resource.en_US.resx new file mode 100644 index 00000000..2ed34433 --- /dev/null +++ b/EnvelopeGenerator.Application/Resources/Resource.en_US.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Hello!! + + \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Resources/Resource.resx b/EnvelopeGenerator.Application/Resources/Resource.resx new file mode 100644 index 00000000..cad038d8 --- /dev/null +++ b/EnvelopeGenerator.Application/Resources/Resource.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Hallo!! + + \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Services/ConfigService.cs b/EnvelopeGenerator.Application/Services/ConfigService.cs index 67dcf11b..06cd4e8b 100644 --- a/EnvelopeGenerator.Application/Services/ConfigService.cs +++ b/EnvelopeGenerator.Application/Services/ConfigService.cs @@ -1,30 +1,27 @@ using AutoMapper; using DigitalData.Core.Application; -using DigitalData.Core.Contracts.Application; -using DigitalData.Core.Contracts.CultureServices; +using DigitalData.Core.DTO; using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Application.DTOs; +using EnvelopeGenerator.Application.Resources; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; +using Microsoft.Extensions.Localization; namespace EnvelopeGenerator.Application.Services { public class ConfigService : BasicCRUDService, IConfigService { - public ConfigService(IConfigRepository repository, IKeyTranslationService translationService, IMapper mapper) : base(repository, translationService, mapper) + public ConfigService(IConfigRepository repository, IStringLocalizer localizer, IMapper mapper) : base(repository, localizer, mapper) { } - public async Task> ReadFirstAsync() + public async Task> ReadFirstAsync() { var config = await _repository.ReadFirstAsync(); - - if (config is null) - return Failed("There is no configuration in DB."); - - return Successful(_mapper.MapOrThrow(config)); + return config is null ? Result.Fail().Message("There is no configuration in DB.") : Result.Success(_mapper.MapOrThrow(config)); } - public async Task> ReadDefaultAsync() => await ReadFirstAsync(); + public async Task> ReadDefaultAsync() => await ReadFirstAsync(); } } \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Services/DocumentReceiverElementService.cs b/EnvelopeGenerator.Application/Services/DocumentReceiverElementService.cs index 5fd3b4c6..6f25514a 100644 --- a/EnvelopeGenerator.Application/Services/DocumentReceiverElementService.cs +++ b/EnvelopeGenerator.Application/Services/DocumentReceiverElementService.cs @@ -1,17 +1,18 @@ using AutoMapper; using DigitalData.Core.Application; -using DigitalData.Core.Contracts.CultureServices; using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Application.DTOs; +using EnvelopeGenerator.Application.Resources; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; +using Microsoft.Extensions.Localization; namespace EnvelopeGenerator.Application.Services { public class DocumentReceiverElementService : BasicCRUDService, IDocumentReceiverElementService { - public DocumentReceiverElementService(IDocumentReceiverElementRepository repository, IKeyTranslationService translationService, IMapper mapper) - : base(repository, translationService, mapper) + public DocumentReceiverElementService(IDocumentReceiverElementRepository repository, IStringLocalizer localizer, IMapper mapper) + : base(repository, localizer, mapper) { } } diff --git a/EnvelopeGenerator.Application/Services/DocumentStatusService.cs b/EnvelopeGenerator.Application/Services/DocumentStatusService.cs index 7c6f6306..f52d789a 100644 --- a/EnvelopeGenerator.Application/Services/DocumentStatusService.cs +++ b/EnvelopeGenerator.Application/Services/DocumentStatusService.cs @@ -1,17 +1,18 @@ using AutoMapper; using DigitalData.Core.Application; -using DigitalData.Core.Contracts.CultureServices; using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Application.DTOs; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; +using Microsoft.Extensions.Localization; +using EnvelopeGenerator.Application.Resources; namespace EnvelopeGenerator.Application.Services { public class DocumentStatusService : BasicCRUDService, IDocumentStatusService { - public DocumentStatusService(IDocumentStatusRepository repository, IKeyTranslationService translationService, IMapper mapper) - : base(repository, translationService, mapper) + public DocumentStatusService(IDocumentStatusRepository repository, IStringLocalizer localizer, IMapper mapper) + : base(repository, localizer, mapper) { } } diff --git a/EnvelopeGenerator.Application/Services/EmailOutService.cs b/EnvelopeGenerator.Application/Services/EmailOutService.cs index e022f369..895f2f95 100644 --- a/EnvelopeGenerator.Application/Services/EmailOutService.cs +++ b/EnvelopeGenerator.Application/Services/EmailOutService.cs @@ -1,16 +1,17 @@ using AutoMapper; using DigitalData.Core.Application; -using DigitalData.Core.Contracts.CultureServices; using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Application.DTOs; +using EnvelopeGenerator.Application.Resources; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; +using Microsoft.Extensions.Localization; namespace EnvelopeGenerator.Application.Services { public class EmailOutService : BasicCRUDService, IEmailOutService { - public EmailOutService(IEmailOutRepository repository, IKeyTranslationService translationService, IMapper mapper) : base(repository, translationService, mapper) + public EmailOutService(IEmailOutRepository repository, IStringLocalizer localizer, IMapper mapper) : base(repository, localizer, mapper) { } } diff --git a/EnvelopeGenerator.Application/Services/EmailTemplateService.cs b/EnvelopeGenerator.Application/Services/EmailTemplateService.cs index 653ef99c..34f133f4 100644 --- a/EnvelopeGenerator.Application/Services/EmailTemplateService.cs +++ b/EnvelopeGenerator.Application/Services/EmailTemplateService.cs @@ -1,17 +1,18 @@ using AutoMapper; using DigitalData.Core.Application; -using DigitalData.Core.Contracts.CultureServices; +using Microsoft.Extensions.Localization; using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Application.DTOs; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; +using EnvelopeGenerator.Application.Resources; namespace EnvelopeGenerator.Application.Services { public class EmailTemplateService : BasicCRUDService, IEmailTemplateService { - public EmailTemplateService(IEmailTemplateRepository repository, IKeyTranslationService translationService, IMapper mapper) - : base(repository, translationService, mapper) + public EmailTemplateService(IEmailTemplateRepository repository, IStringLocalizer localizer, IMapper mapper) + : base(repository, localizer, mapper) { } } diff --git a/EnvelopeGenerator.Application/Services/EnvelopeCertificateService.cs b/EnvelopeGenerator.Application/Services/EnvelopeCertificateService.cs index 9752a0d3..807ba729 100644 --- a/EnvelopeGenerator.Application/Services/EnvelopeCertificateService.cs +++ b/EnvelopeGenerator.Application/Services/EnvelopeCertificateService.cs @@ -1,17 +1,18 @@ using AutoMapper; using DigitalData.Core.Application; -using DigitalData.Core.Contracts.CultureServices; +using Microsoft.Extensions.Localization; using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Application.DTOs; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; +using EnvelopeGenerator.Application.Resources; namespace EnvelopeGenerator.Application.Services { public class EnvelopeCertificateService : BasicCRUDService, IEnvelopeCertificateService { - public EnvelopeCertificateService(IEnvelopeCertificateRepository repository, IKeyTranslationService translationService, IMapper mapper) - : base(repository, translationService, mapper) + public EnvelopeCertificateService(IEnvelopeCertificateRepository repository, IStringLocalizer localizer, IMapper mapper) + : base(repository, localizer, mapper) { } } diff --git a/EnvelopeGenerator.Application/Services/EnvelopeDocumentService.cs b/EnvelopeGenerator.Application/Services/EnvelopeDocumentService.cs index 048e1589..36e880cc 100644 --- a/EnvelopeGenerator.Application/Services/EnvelopeDocumentService.cs +++ b/EnvelopeGenerator.Application/Services/EnvelopeDocumentService.cs @@ -1,17 +1,18 @@ using AutoMapper; using DigitalData.Core.Application; using DigitalData.Core.Contracts.Application; -using DigitalData.Core.Contracts.CultureServices; +using Microsoft.Extensions.Localization; using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Application.DTOs; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; +using EnvelopeGenerator.Application.Resources; namespace EnvelopeGenerator.Application.Services { public class EnvelopeDocumentService : BasicCRUDService, IEnvelopeDocumentService { - public EnvelopeDocumentService(IEnvelopeDocumentRepository repository, IKeyTranslationService translationService, IMapper mapper) : base(repository, translationService, mapper) + public EnvelopeDocumentService(IEnvelopeDocumentRepository repository, IStringLocalizer localizer, IMapper mapper) : base(repository, localizer, mapper) { } } diff --git a/EnvelopeGenerator.Application/Services/EnvelopeHistoryService.cs b/EnvelopeGenerator.Application/Services/EnvelopeHistoryService.cs index f2f9fd63..3e01947f 100644 --- a/EnvelopeGenerator.Application/Services/EnvelopeHistoryService.cs +++ b/EnvelopeGenerator.Application/Services/EnvelopeHistoryService.cs @@ -1,18 +1,19 @@ using AutoMapper; using DigitalData.Core.Application; -using DigitalData.Core.Contracts.CultureServices; +using Microsoft.Extensions.Localization; using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Application.DTOs; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; using static EnvelopeGenerator.Common.Constants; +using EnvelopeGenerator.Application.Resources; namespace EnvelopeGenerator.Application.Services { public class EnvelopeHistoryService : BasicCRUDService, IEnvelopeHistoryService { - public EnvelopeHistoryService(IEnvelopeHistoryRepository repository, IKeyTranslationService translationService, IMapper mapper) - : base(repository, translationService, mapper) + public EnvelopeHistoryService(IEnvelopeHistoryRepository repository, IStringLocalizer localizer, IMapper mapper) + : base(repository, localizer, mapper) { } diff --git a/EnvelopeGenerator.Application/Services/EnvelopeReceiverService.cs b/EnvelopeGenerator.Application/Services/EnvelopeReceiverService.cs index cdfa33ed..ca164e81 100644 --- a/EnvelopeGenerator.Application/Services/EnvelopeReceiverService.cs +++ b/EnvelopeGenerator.Application/Services/EnvelopeReceiverService.cs @@ -1,110 +1,108 @@ using AutoMapper; using DigitalData.Core.Application; -using DigitalData.Core.Contracts.Application; -using DigitalData.Core.Contracts.CultureServices; +using DigitalData.Core.DTO; using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Application.DTOs; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; +using Microsoft.Extensions.Localization; +using Microsoft.Extensions.Logging; +using EnvelopeGenerator.Application.Resources; namespace EnvelopeGenerator.Application.Services { public class EnvelopeReceiverService : BasicCRUDService, IEnvelopeReceiverService { - public EnvelopeReceiverService(IEnvelopeReceiverRepository repository, IKeyTranslationService translationService, IMapper mapper) - : base(repository, translationService, mapper) + public EnvelopeReceiverService(IEnvelopeReceiverRepository repository, IStringLocalizer localizer, IMapper mapper) + : base(repository, localizer, mapper) { } - public async Task>> ReadBySignatureAsync(string signature, bool withEnvelope = false, bool withReceiver = true) + public async Task>> ReadBySignatureAsync(string signature, bool withEnvelope = false, bool withReceiver = true) { var env_rcvs = await _repository.ReadBySignatureAsync(signature: signature, withEnvelope: withEnvelope, withReceiver: withReceiver); - return Successful(_mapper.MapOrThrow>(env_rcvs)); + return Result.Success(_mapper.MapOrThrow>(env_rcvs)); } - public async Task>> ReadByUuidAsync(string uuid, bool withEnvelope = true, bool withReceiver = false) + public async Task>> ReadByUuidAsync(string uuid, bool withEnvelope = true, bool withReceiver = false) { var env_rcvs = await _repository.ReadByUuidAsync(uuid: uuid, withEnvelope: withEnvelope, withReceiver: withReceiver); - return Successful(_mapper.MapOrThrow>(env_rcvs)); + return Result.Success(_mapper.MapOrThrow>(env_rcvs)); } - public async Task> ReadByUuidSignatureAsync(string uuid, string signature, bool withEnvelope = true, bool withReceiver = true) + public async Task> ReadByUuidSignatureAsync(string uuid, string signature, bool withEnvelope = true, bool withReceiver = true) { var env_rcv = await _repository.ReadByUuidSignatureAsync(uuid: uuid, signature: signature, withEnvelope: withEnvelope, withReceiver: withReceiver); if (env_rcv is null) - return Failed() - .WithClientMessageKey(MessageKey.EnvelopeReceiverNotFound); + return Result.Fail() + .Message(Key.EnvelopeReceiverNotFound); - return Successful(_mapper.MapOrThrow(env_rcv)); + return Result.Success(_mapper.MapOrThrow(env_rcv)); } - public async Task> ReadByEnvelopeReceiverIdAsync(string envelopeReceiverId, bool withEnvelope = true, bool withReceiver = true) + public async Task> ReadByEnvelopeReceiverIdAsync(string envelopeReceiverId, bool withEnvelope = true, bool withReceiver = true) { (string? uuid, string? signature) = envelopeReceiverId.DecodeEnvelopeReceiverId(); if (uuid is null || signature is null) - return Failed() - .WithClientMessageKey(MessageKey.WrongEnvelopeReceiverId2Client) - .WithWarningMessage((uuid, signature).ToTitle()) - .WithWarningMessageKey(MessageKey.WrongEnvelopeReceiverId2Logger) - .WithWarningMessageKey(MessageKey.PossibleSecurityBreach) - .WithFlag(Flag.PossibleSecurityBreach); + return Result.Fail() + .Message(_localizer[Key.WrongEnvelopeReceiverId]) + .Notice(LogLevel.Warning, (uuid, signature).ToTitle()) + .Notice(LogLevel.Warning, EnvelopeFlag.WrongEnvelopeReceiverId) + .Notice(LogLevel.Warning, Flag.PossibleSecurityBreach); return await ReadByUuidSignatureAsync(uuid: uuid, signature: signature, withEnvelope: withEnvelope, withReceiver: withReceiver); } - public async Task> VerifyAccessCodeAsync(string uuid, string signature, string accessCode) + public async Task> VerifyAccessCodeAsync(string uuid, string signature, string accessCode) { var er = await _repository.ReadByUuidSignatureAsync(uuid: uuid, signature: signature); if (er is null) - return Failed() - .WithClientMessageKey(MessageKey.EnvelopeOrReceiverNonexists) - .WithWarningMessage((uuid, signature).ToTitle()) - .WithWarningMessageKey(MessageKey.EnvelopeOrReceiverNonexists) - .WithWarningMessageKey(MessageKey.PossibleDataIntegrityIssue) - .WithFlag(MessageKey.PossibleDataIntegrityIssue); + return Result.Fail() + .Message(_localizer[Key.EnvelopeOrReceiverNonexists]) + .Notice(LogLevel.Warning, (uuid, signature).ToTitle()) + .Notice(LogLevel.Warning, EnvelopeFlag.EnvelopeOrReceiverNonexists) + .Notice(LogLevel.Warning, Flag.PossibleDataIntegrityIssue); var actualAccessCode = er.AccessCode; if (actualAccessCode is null) - return Failed() - .WithClientMessageKey(MessageKey.AccessCodeNull2Client) - .WithCriticalMessage((uuid, signature).ToTitle()) - .WithCriticalMessageKey(MessageKey.AccessCodeNull2Logger) - .WithCriticalMessageKey(MessageKey.DataIntegrityIssue) - .WithFlag(Flag.DataIntegrityIssue); - - else if(accessCode != actualAccessCode) - return Successful(false).WithClientMessageKey(MessageKey.WrongAccessCode); + return Result.Fail() + .Message(_localizer[Key.AccessCodeNull]) + .Notice(LogLevel.Critical, (uuid, signature).ToTitle()) + .Notice(LogLevel.Critical, EnvelopeFlag.AccessCodeNull) + .Notice(LogLevel.Critical, Flag.DataIntegrityIssue); + + else if (accessCode != actualAccessCode) + return Result.Success(false).Message(_localizer[Key.WrongAccessCode]); else - return Successful(true); + return Result.Success(true); } - public async Task> VerifyAccessCodeAsync(string envelopeReceiverId, string accessCode) + public async Task> VerifyAccessCodeAsync(string envelopeReceiverId, string accessCode) { (string? uuid, string? signature) = envelopeReceiverId.DecodeEnvelopeReceiverId(); if (uuid is null || signature is null) - return Failed() - .WithClientMessageKey(MessageKey.WrongEnvelopeReceiverId2Client) - .WithCriticalMessageKey(MessageKey.WrongEnvelopeReceiverId2Logger) - .WithCriticalMessageKey(MessageKey.SecurityBreach) - .WithCriticalMessage("Attempt to verify access code detected. Such actions are generally not initiated by well-intentioned users. Potential security breach suspected. Immediate investigation required.") - .WithFlag(Flag.SecurityBreach); + return Result.Fail() + .Message(Key.WrongEnvelopeReceiverId) + .Notice(LogLevel.Critical, EnvelopeFlag.WrongEnvelopeReceiverId) + .Notice(LogLevel.Critical, Flag.SecurityBreach) + .Notice(LogLevel.Critical, "Attempt to verify access code detected. Such actions are generally not initiated by well-intentioned users. Potential security breach suspected. Immediate investigation required."); return await VerifyAccessCodeAsync(uuid: uuid, signature: signature, accessCode: accessCode); } - public async Task> IsExisting(string envelopeReceiverId) + public async Task> IsExisting(string envelopeReceiverId) { (string? uuid, string? signature) = envelopeReceiverId.DecodeEnvelopeReceiverId(); if (uuid is null || signature is null) - return Failed(false).WithFlag(EnvelopeFlag.NonDecodableEnvelopeReceiverId); + return Result.Fail(); int count = await _repository.CountAsync(uuid:uuid, signature:signature); - return Successful(count > 0); + return Result.Success(count > 0); } } } \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Services/EnvelopeService.cs b/EnvelopeGenerator.Application/Services/EnvelopeService.cs index 9bdd7837..a02319b8 100644 --- a/EnvelopeGenerator.Application/Services/EnvelopeService.cs +++ b/EnvelopeGenerator.Application/Services/EnvelopeService.cs @@ -1,40 +1,41 @@ using AutoMapper; using DigitalData.Core.Application; -using DigitalData.Core.Contracts.Application; -using DigitalData.Core.Contracts.CultureServices; +using DigitalData.Core.DTO; using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Application.DTOs; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; +using Microsoft.Extensions.Localization; using Microsoft.Extensions.Logging; +using EnvelopeGenerator.Application.Resources; namespace EnvelopeGenerator.Application.Services { public class EnvelopeService : BasicCRUDService, IEnvelopeService { private readonly ILogger _logger; - public EnvelopeService(IEnvelopeRepository repository, IKeyTranslationService translationService, IMapper mapper, ILogger logger) - : base(repository, translationService, mapper) + public EnvelopeService(IEnvelopeRepository repository, IStringLocalizer localizer, IMapper mapper, ILogger logger) + : base(repository, localizer, mapper) { _logger = logger; } - public async Task>> ReadAllWithAsync(bool documents = false, bool envelopeReceivers = false, bool history = false, bool documentReceiverElement = false) + public async Task>> ReadAllWithAsync(bool documents = false, bool envelopeReceivers = false, bool history = false, bool documentReceiverElement = false) { var envelopes = await _repository.ReadAllWithAsync(documents: documents, envelopeReceivers: envelopeReceivers, history: history, documentReceiverElement: documentReceiverElement); var readDto = _mapper.MapOrThrow>(envelopes); - return Successful(readDto); + return Result.Success(readDto); } - public async Task> ReadByUuidAsync(string uuid, string? signature = null, bool withDocuments = false, bool withEnvelopeReceivers = false, bool withHistory = false, bool withDocumentReceiverElement = false, bool withUser = false, bool withAll = false) + public async Task> ReadByUuidAsync(string uuid, string? signature = null, bool withDocuments = false, bool withEnvelopeReceivers = false, bool withHistory = false, bool withDocumentReceiverElement = false, bool withUser = false, bool withAll = false) { var envelope = await _repository.ReadByUuidAsync(uuid: uuid, signature: signature, withDocuments: withDocuments, withEnvelopeReceivers: withEnvelopeReceivers, withHistory: withHistory, withDocumentReceiverElement: withDocumentReceiverElement, withUser:withUser, withAll:withAll); if (envelope is null) - return Failed(); + return Result.Fail(); var readDto = _mapper.MapOrThrow(envelope); - return Successful(readDto); + return Result.Success(readDto); } } } \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Services/EnvelopeTypeService.cs b/EnvelopeGenerator.Application/Services/EnvelopeTypeService.cs index c48e8a62..c43a0cb8 100644 --- a/EnvelopeGenerator.Application/Services/EnvelopeTypeService.cs +++ b/EnvelopeGenerator.Application/Services/EnvelopeTypeService.cs @@ -1,17 +1,18 @@ using AutoMapper; using DigitalData.Core.Application; -using DigitalData.Core.Contracts.CultureServices; +using Microsoft.Extensions.Localization; using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Application.DTOs; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; +using EnvelopeGenerator.Application.Resources; namespace EnvelopeGenerator.Application.Services { public class EnvelopeTypeService : BasicCRUDService, IEnvelopeTypeService { - public EnvelopeTypeService(IEnvelopeTypeRepository repository, IKeyTranslationService translationService, IMapper mapper) - : base(repository, translationService, mapper) + public EnvelopeTypeService(IEnvelopeTypeRepository repository, IStringLocalizer localizer, IMapper mapper) + : base(repository, localizer, mapper) { } } diff --git a/EnvelopeGenerator.Application/Services/ReceiverService.cs b/EnvelopeGenerator.Application/Services/ReceiverService.cs index 301772a5..9fc76b95 100644 --- a/EnvelopeGenerator.Application/Services/ReceiverService.cs +++ b/EnvelopeGenerator.Application/Services/ReceiverService.cs @@ -1,17 +1,18 @@ using AutoMapper; using DigitalData.Core.Application; -using DigitalData.Core.Contracts.CultureServices; +using Microsoft.Extensions.Localization; using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Application.DTOs; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; +using EnvelopeGenerator.Application.Resources; namespace EnvelopeGenerator.Application.Services { public class ReceiverService : BasicCRUDService, IReceiverService { - public ReceiverService(IReceiverRepository repository, IKeyTranslationService translationService, IMapper mapper) - : base(repository, translationService, mapper) + public ReceiverService(IReceiverRepository repository, IStringLocalizer localizer, IMapper mapper) + : base(repository, localizer, mapper) { } } diff --git a/EnvelopeGenerator.Application/Services/UserReceiverService.cs b/EnvelopeGenerator.Application/Services/UserReceiverService.cs index 57d9c1aa..9fe3ee72 100644 --- a/EnvelopeGenerator.Application/Services/UserReceiverService.cs +++ b/EnvelopeGenerator.Application/Services/UserReceiverService.cs @@ -1,17 +1,18 @@ using AutoMapper; using DigitalData.Core.Application; -using DigitalData.Core.Contracts.CultureServices; +using Microsoft.Extensions.Localization; using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Application.DTOs; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; +using EnvelopeGenerator.Application.Resources; namespace EnvelopeGenerator.Application.Services { public class UserReceiverService : BasicCRUDService, IUserReceiverService { - public UserReceiverService(IUserReceiverRepository repository, IKeyTranslationService translationService, IMapper mapper) - : base(repository, translationService, mapper) + public UserReceiverService(IUserReceiverRepository repository, IStringLocalizer localizer, IMapper mapper) + : base(repository, localizer, mapper) { } } diff --git a/EnvelopeGenerator.Web/Controllers/HomeController.cs b/EnvelopeGenerator.Web/Controllers/HomeController.cs index bd8d544d..c1c4802d 100644 --- a/EnvelopeGenerator.Web/Controllers/HomeController.cs +++ b/EnvelopeGenerator.Web/Controllers/HomeController.cs @@ -8,11 +8,10 @@ using Microsoft.AspNetCore.Mvc; using System.Security.Claims; using Microsoft.AspNetCore.Authorization; using DigitalData.Core.API; -using DigitalData.Core.Application; using EnvelopeGenerator.Application; -using DigitalData.Core.Contracts.CultureServices; -using DigitalData.Core.CultureServices; -using Azure; +using Microsoft.Extensions.Localization; +using DigitalData.Core.DTO; +using EnvelopeGenerator.Application.Resources; namespace EnvelopeGenerator.Web.Controllers { @@ -22,15 +21,15 @@ namespace EnvelopeGenerator.Web.Controllers private readonly IEnvelopeReceiverService _envRcvService; private readonly IEnvelopeService _envelopeService; private readonly IEnvelopeHistoryService _historyService; - private readonly IKeyTranslationService _translator; + private readonly IStringLocalizer _localizer; - public HomeController(DatabaseService databaseService, EnvelopeOldService envelopeOldService, ILogger logger, IEnvelopeReceiverService envelopeReceiverService, IEnvelopeService envelopeService, IEnvelopeHistoryService historyService, IKeyTranslationService keyTranslationService) : base(databaseService, logger) + public HomeController(DatabaseService databaseService, EnvelopeOldService envelopeOldService, ILogger logger, IEnvelopeReceiverService envelopeReceiverService, IEnvelopeService envelopeService, IEnvelopeHistoryService historyService, IStringLocalizer localizer) : base(databaseService, logger) { this.envelopeOldService = envelopeOldService; _envRcvService = envelopeReceiverService; _envelopeService = envelopeService; _historyService = historyService; - _translator = keyTranslationService; + _localizer = localizer; } [HttpGet("/EnvelopeKey/{envelopeReceiverId}")] @@ -47,7 +46,7 @@ namespace EnvelopeGenerator.Web.Controllers if (erResult is null) { - _logger.LogError(MessageKey.ServiceOutputNullError.TranslateWith(_translator)); + _logger.LogError(_localizer[MessageKey.ServiceOutputNullError.ToString()]); return this.ViewEnvelopeNotFound(); } else if (erResult.IsSuccess && mailAddress is not null && (envelope?.UseAccessCode ?? false)) @@ -65,13 +64,13 @@ namespace EnvelopeGenerator.Web.Controllers } else { - _logger.LogServiceMessage(erResult); + _logger.LogNotice(erResult); return this.ViewEnvelopeNotFound(); } } catch(Exception ex) { - _logger.LogEnvelopeError(envelopeEeceiverId: envelopeReceiverId, exception:ex, message: MessageKey.UnexpectedError.TranslateWith(_translator)); + _logger.LogEnvelopeError(envelopeEeceiverId: envelopeReceiverId, exception:ex, message: _localizer[MessageKey.UnexpectedError.ToString()]); return this.ViewInnerServiceError(); } @@ -107,8 +106,8 @@ namespace EnvelopeGenerator.Web.Controllers if(uuid is null || signature is null) { - _logger.LogEnvelopeError(uuid: uuid, signature: signature, message: MessageKey.WrongEnvelopeReceiverId.TranslateWith(_translator)); - return BadRequest(_envelopeService.CreateMessage(false, MessageKey.WrongEnvelopeReceiverId.ToString())); + _logger.LogEnvelopeError(uuid: uuid, signature: signature, message: _localizer[MessageKey.WrongEnvelopeReceiverId.ToString()]); + return BadRequest(_localizer[MessageKey.WrongEnvelopeReceiverId.ToString()]); } _logger.LogInformation($"Envelope UUID: [{uuid}]\nReceiver Signature: [{signature}]"); @@ -120,12 +119,12 @@ namespace EnvelopeGenerator.Web.Controllers if (!verification.IsSuccess) { - _logger.LogServiceMessage(verification); + _logger.LogNotice(verification); if (verification.HasFlag(Flag.SecurityBreach)) return Forbid(); - return StatusCode(StatusCodes.Status500InternalServerError, verification.ClientMessages.Join()); + return StatusCode(StatusCodes.Status500InternalServerError, string.Join(". ", verification.Messages).Append('.')); } else if (isVerified) { diff --git a/EnvelopeGenerator.Web/Controllers/Test/TestEnvelopeReceiverController.cs b/EnvelopeGenerator.Web/Controllers/Test/TestEnvelopeReceiverController.cs index 6d70ddca..d0af7c34 100644 --- a/EnvelopeGenerator.Web/Controllers/Test/TestEnvelopeReceiverController.cs +++ b/EnvelopeGenerator.Web/Controllers/Test/TestEnvelopeReceiverController.cs @@ -1,5 +1,5 @@ using DigitalData.Core.API; -using DigitalData.Core.Application; +using DigitalData.Core.DTO; using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Application.DTOs; using EnvelopeGenerator.Application.Services; diff --git a/EnvelopeGenerator.Web/Controllers/Test/TestLocalizerController.cs b/EnvelopeGenerator.Web/Controllers/Test/TestLocalizerController.cs new file mode 100644 index 00000000..65370554 --- /dev/null +++ b/EnvelopeGenerator.Web/Controllers/Test/TestLocalizerController.cs @@ -0,0 +1,19 @@ +using EnvelopeGenerator.Application; +using EnvelopeGenerator.Application.Resources; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Localization; + +namespace EnvelopeGenerator.Web.Controllers.Test +{ + [ApiController] + [Route("api/test/[controller]")] + public class TestLocalizerController : ControllerBase + { + private readonly IStringLocalizer _localizer; + + public TestLocalizerController(IStringLocalizer localizer) => _localizer = localizer; + + [HttpGet] + public IActionResult Localize([FromQuery] string key = "Hello") => Ok(_localizer[key]); + } +} diff --git a/EnvelopeGenerator.Web/EnvelopeGenerator.Web.csproj b/EnvelopeGenerator.Web/EnvelopeGenerator.Web.csproj index 220e8fc6..e2114c7b 100644 --- a/EnvelopeGenerator.Web/EnvelopeGenerator.Web.csproj +++ b/EnvelopeGenerator.Web/EnvelopeGenerator.Web.csproj @@ -55,8 +55,8 @@ ..\..\WebCoreModules\DigitalData.Core.Contracts\bin\Debug\net7.0\DigitalData.Core.Contracts.dll - - ..\..\WebCoreModules\DigitalData.Core.CultureServices\bin\Debug\net7.0\DigitalData.Core.CultureServices.dll + + ..\..\WebCoreModules\DigitalData.Core.API\bin\Debug\net7.0\DigitalData.Core.DTO.dll ..\..\WebCoreModules\DigitalData.Core.Infrastructure\bin\Debug\net7.0\DigitalData.Core.Infrastructure.dll diff --git a/EnvelopeGenerator.Web/Program.cs b/EnvelopeGenerator.Web/Program.cs index 84d28b61..0ba100e0 100644 --- a/EnvelopeGenerator.Web/Program.cs +++ b/EnvelopeGenerator.Web/Program.cs @@ -1,4 +1,3 @@ -using DigitalData.Core.CultureServices; using DigitalData.UserManager.Infrastructure.Repositories; using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Application.MappingProfiles; @@ -12,9 +11,10 @@ using Quartz; using NLog.Web; using DigitalData.Core.API; using Microsoft.AspNetCore.Authentication.Cookies; -using DigitalData.Core.Application; using DigitalData.UserManager.Application.MappingProfiles; using EnvelopeGenerator.Web.Models; +using DigitalData.Core.DTO; +using Microsoft.Extensions.Localization; var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger(); logger.Info("Logging initialized!"); @@ -47,8 +47,6 @@ try builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); - builder.Services.AddKeyTranslationService(); - //AddEF Core dbcontext var connStr = builder.Configuration["Config:ConnectionString"]; builder.Services.AddDbContext(options => @@ -137,6 +135,8 @@ try builder.Services.AddCookieConsentSettings(); + builder.Services.AddCookieBasedLocalizer(); + var app = builder.Build(); // Configure the HTTP request pipeline. @@ -159,6 +159,8 @@ try app.UseAuthentication(); app.UseAuthorization(); + app.UseCookieBasedLocalizer("de_DE", "en_US"); + app.MapControllers(); app.MapFallbackToController("Error404", "Home"); app.Run(); diff --git a/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml b/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml index 7b339119..83a73c9a 100644 --- a/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml +++ b/EnvelopeGenerator.Web/Views/Home/ShowEnvelope.cshtml @@ -1,6 +1,6 @@ -@using DigitalData.Core.Contracts.Application; +@using DigitalData.Core.DTO; @using EnvelopeGenerator.Application.DTOs; -@model IServiceResult; +@model DataResult; @{ ViewData["Title"] = "Dokument unterschreiben"; } diff --git a/EnvelopeGenerator.Web/Views/Shared/_CookieConsentPartial.cshtml b/EnvelopeGenerator.Web/Views/Shared/_CookieConsentPartial.cshtml index 1c54ec03..96c526f5 100644 --- a/EnvelopeGenerator.Web/Views/Shared/_CookieConsentPartial.cshtml +++ b/EnvelopeGenerator.Web/Views/Shared/_CookieConsentPartial.cshtml @@ -1,4 +1,4 @@ -@using DigitalData.Core.Application.DTO; +@using DigitalData.Core.DTO; @using Microsoft.AspNetCore.Http.Features @using Newtonsoft.Json.Serialization; @using Newtonsoft.Json;