我有 2 个模型,一个订单标题和订单详细信息。
我想最终得到来自服务器的 JSON 回复,如下所示:
--OrderHeader 1
|
--OrderDetails 1
--OrderHeader 2
|
--Order Detail 2
我会使用实体框架创建某种子查询棒并通过我的 WebGet 返回它,还是我会运行单独的查询并在获得结果后整合格式?
这是我的视图模型:
public class OpenOrderHeader
{
public int CustomerID { get; set; }
public int OrderID { get; set; }
public int OrderUniqueNumber { get; set; }
public int NumberOfProductsOnOrder { get; set; }
public DateTime OrderDateCreated { get; set; }
public DateTime OrderDateUpdated { get; set; }
public string OrderLocalOnline { get; set; }
public int BranchID { get; set; }
public string PaymentMethod { get; set; }
public int OrderStatus { get; set; }
public string OrderCurrency { get; set; }
public decimal OrderConversionRate { get; set; }
public decimal SubTotalInclTax { get; set; }
public decimal SubTotalExclTax { get; set; }
public decimal DiscountInclTax { get; set; }
public decimal DiscountExclTax { get; set; }
public decimal ShippingInclTax { get; set; }
public decimal ShippingExclTax { get; set; }
public decimal PaymentFeeInclTax { get; set; }
public decimal PaymentFeeExclTax { get; set; }
}
public class OpenOrderProducts
{
public int OrderID { get; set; }
public string ProductSKUName { get; set; }
public int ProductSKUID { get; set; }
public string ProductSKUStockCode { get; set; }
public DateTime ProductAddedToOrder { get; set; }
public int QtyOfProductsOnOrder { get; set; }
public decimal UnitPriceinclTax { get; set; }
public decimal UnitPriceExclTax { get; set; }
public decimal UnitDiscountInclTax { get; set; }
public decimal UnitDiscountExclTax { get; set; }
public decimal LineItemTotalIncludingTax { get; set; }
public decimal LineItemExclTax { get; set; }
public decimal LineItemShippingCost { get; set; }
}