36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using System.Text.Json;
|
|
|
|
namespace Expose.MyIT.Shared.ViewModels;
|
|
|
|
public record ServiceShopOrder(string Id,
|
|
string Name,
|
|
string[] BookingNames,
|
|
string Type,
|
|
string State,
|
|
string ItemNumber,
|
|
DateTime CreatedDate,
|
|
DateTime DecidedDate,
|
|
string Recipient,
|
|
string Requestor)
|
|
{
|
|
|
|
public ServiceShopOrder(Models.Order order) :
|
|
this(order.Id,
|
|
order.Name,
|
|
order.Bookings is null || !order.Bookings.Any() ? Array.Empty<string>() : order.Bookings.Select(l => l.Name).ToArray(),
|
|
order.Type,
|
|
order.State,
|
|
order.ItemNumber,
|
|
order.CreatedDate,
|
|
order.DecidedDate,
|
|
order.Recipient,
|
|
order.Requestor)
|
|
{ }
|
|
|
|
public override string ToString()
|
|
{
|
|
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
|
return result;
|
|
}
|
|
|
|
} |