Basket persistence (#41)

* Renamed Cart to Basket throughout
* Implemented cookie-based anonymous basket handling and transfer to user upon login. Still need to implement transfer upon registration.
This commit is contained in:
Steve Smith
2017-08-22 13:51:08 -04:00
committed by GitHub
parent 3a95375ae7
commit ecb4889dd3
10 changed files with 173 additions and 118 deletions

View File

@@ -13,10 +13,18 @@ namespace ApplicationCore.Specifications
BasketId = basketId;
AddInclude(b => b.Items);
}
public BasketWithItemsSpecification(string buyerId)
{
BuyerId = buyerId;
AddInclude(b => b.Items);
}
public int BasketId { get; }
public int? BasketId { get; }
public string BuyerId { get; }
public Expression<Func<Basket, bool>> Criteria => b => b.Id == BasketId;
public Expression<Func<Basket, bool>> Criteria => b =>
(BasketId.HasValue && b.Id == BasketId.Value)
|| (BuyerId != null && b.BuyerId == BuyerId);
public List<Expression<Func<Basket, object>>> Includes { get; } = new List<Expression<Func<Basket, object>>>();