31 lines
765 B
C#
31 lines
765 B
C#
using RomashkiContract.BindingModels;
|
|
using RomashkiContracts.Enums;
|
|
|
|
namespace Romashki;
|
|
|
|
public class TestMapping
|
|
{
|
|
public static void TestProductTypeMapping()
|
|
{
|
|
var productModel = new ProductBindingModel
|
|
{
|
|
Id = Guid.NewGuid().ToString(),
|
|
ProductName = "Test Product",
|
|
ProductType = "Flower",
|
|
Price = 10.0
|
|
};
|
|
|
|
Console.WriteLine($"ProductType string: {productModel.ProductType}");
|
|
|
|
if (Enum.TryParse<ProductType>(productModel.ProductType, true, out var productType))
|
|
{
|
|
Console.WriteLine($"Parsed ProductType: {productType}");
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine("Failed to parse ProductType");
|
|
}
|
|
}
|
|
}
|
|
|