Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. namespace Olympia.Data.Domain
  2. {
  3. using System.Collections.Generic;
  4. using System.ComponentModel.DataAnnotations;
  5. using System.Linq;
  6.  
  7. using Olympia.Data.Common.Models;
  8.  
  9. public class ShoppingCart : BaseModel<string>
  10. {
  11. public ShoppingCart()
  12. {
  13. this.Items = new List<Item>();
  14. }
  15.  
  16.  
  17.  
  18. public string UserId { get; set; }
  19.  
  20. public OlympiaUser User { get; set; }
  21.  
  22. public decimal EndPrice => this.GetEndPrice();
  23.  
  24. public virtual ICollection<Item> Items { get; set; }
  25.  
  26. private decimal GetEndPrice()
  27. {
  28. return this.Items.Sum(item => item.Price);
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement