我有两节课ShoppingCart
,CartItems
像这样:
public class ShoppingCart
{
public Guid Id { get; set; }
public DateTime CreatedOn { get; set; }
public Guid OwnerId { get; set; }
public ICollection<CartItem> Items { get; set; }
}
public class CartItem
{
public Guid Id { get; set; }}
public int Quantity { get; set; }
public Guid ProductId { get; set; }
public Guid ShoppingCartId { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我想CartItems
通过ownerId
使用这种方法获得所有:
public IEnumerable<CartItem> GetCartItems(Guid ownerId) …
Run Code Online (Sandbox Code Playgroud)