DimerceDemoApplication/models/OrderModel.cs

17 lines
No EOL
482 B
C#

using DTO;
public sealed class OrderModel {
public long OrderId { get; set; }
public string OrderDescription { get; set; }
public long CustomerId { get; set; }
public double TotalPrice { get; set; }
public OrderModel(OrderDto orderDTO) {
OrderId = orderDTO.OrderId;
OrderDescription = orderDTO.Description.Trim();
CustomerId = orderDTO.CustomerId;
TotalPrice = orderDTO.Products.Select(product => product.Price).Sum();
}
}