diff --git a/EnvelopeGenerator.ReceiverUI/Models/SignatureDto.cs b/EnvelopeGenerator.ReceiverUI/Models/SignatureDto.cs index 07790b5c..c54ff873 100644 --- a/EnvelopeGenerator.ReceiverUI/Models/SignatureDto.cs +++ b/EnvelopeGenerator.ReceiverUI/Models/SignatureDto.cs @@ -65,4 +65,37 @@ public class SignatureDto }; } } +} + +public static class SignatureDtoExtensions +{ + /// + /// Converts all signatures in the collection to the specified unit of length. + /// + /// Type of the collection (IEnumerable, List, etc.) + /// Collection of SignatureDto objects to convert. + /// Target unit of measurement (Inch or Point). + /// The same collection with all signatures converted to the specified unit. + /// Thrown when signatures collection is null. + /// + /// Usage: + /// + /// var signatures = await SignatureService.GetAsync(envelopeKey); + /// var convertedSignatures = signatures.ConvertAll(UnitOfLength.Point); + /// + /// Note: This method modifies each SignatureDto object in place and returns the same collection. + /// + public static T Convert(this T signatures, UnitOfLength unitOfLength) + where T : IEnumerable + { + if (signatures == null) + throw new ArgumentNullException(nameof(signatures)); + + foreach (var signature in signatures) + { + signature.Convert(unitOfLength); + } + + return signatures; + } } \ No newline at end of file