src/Web/WebMVC/ViewModels/Basket.cs

(完整代码) 500B

namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;

public record Basket
{
    // Use property initializer syntax.
    // While this is often more useful for read only 
    // auto implemented properties, it can simplify logic
    // for read/write properties.
    public List<BasketItem> Items { get; init; } = new List<BasketItem>();
    public string BuyerId { get; init; }

    public decimal Total()
    {
        return Math.Round(Items.Sum(x => x.UnitPrice * x.Quantity), 2);
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。