// 将当前的购物车中的项目转换为订单项 public OrderItem ConvertToOrderItem() { OrderItem orderItem = new OrderItem(); orderItem.Id = Guid.NewGuid(); // 为每个SalesLine设置一个不同的ID,以便EF的Context能够识别不同的OrderItem orderItem.Product = this.Product; orderItem.Quantity = this.Quantity; return orderItem; }
// 将当前的购物车中的项目转换为订单项 public OrderItem ConvertToOrderItem() { var orderItem = new OrderItem { Id = Guid.NewGuid(), Product = this.Product, Quantity = this.Quantity }; return orderItem; }