Creation
This commit is contained in:
52
Shared/ViewModels/SsaOrder.cs
Normal file
52
Shared/ViewModels/SsaOrder.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Expose.MyIT.Shared.ViewModels;
|
||||
|
||||
public class SsaOrder
|
||||
{
|
||||
|
||||
public string Id { init; get; }
|
||||
public string Name { init; get; }
|
||||
public string[] BookingNames { init; get; }
|
||||
public string Type { init; get; }
|
||||
public string State { init; get; }
|
||||
public string ItemNumber { init; get; }
|
||||
public DateTime CreatedDate { init; get; }
|
||||
public DateTime DecidedDate { init; get; }
|
||||
public string Recipient { init; get; }
|
||||
public string Requestor { init; get; }
|
||||
|
||||
public SsaOrder(string id, string name, string[] bookingNames, string type, string state, string itemNumber, DateTime createdDate, DateTime decidedDate, string recipient, string requestor)
|
||||
{
|
||||
Id = id;
|
||||
Name = name;
|
||||
BookingNames = bookingNames;
|
||||
Type = type;
|
||||
State = state;
|
||||
ItemNumber = itemNumber;
|
||||
CreatedDate = createdDate;
|
||||
DecidedDate = decidedDate;
|
||||
Recipient = recipient;
|
||||
Requestor = requestor;
|
||||
}
|
||||
|
||||
public SsaOrder(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;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user