A variation of shopping cart DTOs that violate C# naming standards for propertie...
source link: https://gist.github.com/einarwh/bb4809047c366132374dae89ab6b5b43
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Instantly share code, notes, and snippets.
public abstract class ShoppingCart { public ShoppingCart(string state) { _state = state; }
public string _state { get; } }
public class EmptyCart : ShoppingCart { public EmptyCart() : base("empty") {} }
public class ActiveCart : ShoppingCart { public ActiveCart() : base("active") { } public Item[] unpaidItems { get; set; } }
public class PaidCart : ShoppingCart { public PaidCart() : base("paid") {} public object[] paidItems { get; set; } public Money payment { get; set; } public string timestamp { get; set; } }
public class Item { public string id { get; set; } public string title { get; set; } public string description { get; set; } }
public class Money { public float amount { get; set; } public string currency { get; set; } }
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK