Created
February 2, 2022 15:07
-
-
Save mortezadalil/ed7cbe0952aff45fba26711afa2d75f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Basket.Api.Models | |
{ | |
public class Basket | |
{ | |
public Basket(string userName) | |
{ | |
this.UserName = userName; | |
} | |
public string UserName { get; set; } | |
public List<BasketItem> BasketItems | |
{ | |
get; set; | |
} = new List<BasketItem>(); | |
public long TotalPrice | |
{ | |
get | |
{ | |
return BasketItems.Sum(x => x.Price * x.Count); | |
} | |
} | |
} | |
public class BasketItem | |
{ | |
public int Count { get; set; } | |
public int ProductId { get; set; } | |
public string ProductName { get; set; } | |
public long Price { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment