28 lines
841 B
C#
28 lines
841 B
C#
namespace TaxBaik.Application.Services;
|
|
|
|
using TaxBaik.Domain.Enums;
|
|
|
|
public static class InquiryStatusMapper
|
|
{
|
|
public static string ToStorageValue(InquiryStatus status) => status switch
|
|
{
|
|
InquiryStatus.New => "new",
|
|
InquiryStatus.Contacted => "contacted",
|
|
InquiryStatus.Completed => "completed",
|
|
_ => throw new ArgumentOutOfRangeException(nameof(status), status, null)
|
|
};
|
|
|
|
public static bool TryParse(string? value, out InquiryStatus status)
|
|
{
|
|
status = value?.Trim().ToLowerInvariant() switch
|
|
{
|
|
"new" => InquiryStatus.New,
|
|
"contacted" => InquiryStatus.Contacted,
|
|
"completed" => InquiryStatus.Completed,
|
|
_ => default
|
|
};
|
|
|
|
return value?.Trim().ToLowerInvariant() is "new" or "contacted" or "completed";
|
|
}
|
|
}
|