SHA256
GuestLog - Improvements to GuestDocument creation
- Added DocumentNumber validations. - Added new page to see GuestDocument details.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
namespace Somnia.GuestLog.Models.DTOs;
|
||||
|
||||
public class GuestDocIdDTO
|
||||
{
|
||||
public required string DocumentType { get; set; }
|
||||
public required string DocumentNum { get; set; }
|
||||
|
||||
|
||||
public static string EncodeAsString(GuestDocIdDTO docId)
|
||||
{
|
||||
return $"{docId.DocumentType}-{docId.DocumentNum}";
|
||||
}
|
||||
|
||||
public static GuestDocIdDTO? DecodeFromString(string str)
|
||||
{
|
||||
var parts = str.Split("-");
|
||||
if (parts.Length < 2)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new()
|
||||
{
|
||||
DocumentType = parts[0],
|
||||
DocumentNum = parts[1]
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user