From 4267021fc2a978f7eb5170f7aa47d4686480a4bf Mon Sep 17 00:00:00 2001 From: Eddie Date: Thu, 21 Nov 2024 13:11:31 +0330 Subject: [PATCH] Creating walletId --- EWallet.Api/Common/Models/WalletId.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 EWallet.Api/Common/Models/WalletId.cs diff --git a/EWallet.Api/Common/Models/WalletId.cs b/EWallet.Api/Common/Models/WalletId.cs new file mode 100644 index 0000000..bc891f3 --- /dev/null +++ b/EWallet.Api/Common/Models/WalletId.cs @@ -0,0 +1,24 @@ +namespace EWallet.Api.Common.Models; + +public class WalletId(Guid value) +{ + public Guid Value { get; set; } = value; + + /// + /// Generates a new unique CurrencyId. + /// + /// A new CurrencyId instance with a unique GUID. + public static WalletId NewId() => new WalletId(Guid.NewGuid()); + + /// + /// Creates a CurrencyId from an existing GUID. + /// + /// The GUID value. + /// A CurrencyId instance. + public static WalletId From(Guid value) => new WalletId(value); + + /// + /// Overrides ToString to return the GUID as a string. + /// + public override string ToString() => Value.ToString(); +} \ No newline at end of file