manage basket checkout after login (#371)

This commit is contained in:
Cédric Michel
2020-05-06 21:53:52 +02:00
committed by GitHub
parent fdb4869c0b
commit 516d87aaa1
5 changed files with 25 additions and 7 deletions

View File

@@ -5,6 +5,7 @@ using Microsoft.eShopWeb.ApplicationCore.Entities;
using System.Collections.Generic;
using Ardalis.GuardClauses;
using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate;
using Microsoft.eShopWeb.ApplicationCore.Specifications;
namespace Microsoft.eShopWeb.ApplicationCore.Services
{
@@ -28,7 +29,9 @@ namespace Microsoft.eShopWeb.ApplicationCore.Services
public async Task CreateOrderAsync(int basketId, Address shippingAddress)
{
var basket = await _basketRepository.GetByIdAsync(basketId);
var basketSpec = new BasketWithItemsSpecification(basketId);
var basket = await _basketRepository.FirstOrDefaultAsync(basketSpec);
Guard.Against.NullBasket(basketId, basket);
var items = new List<OrderItem>();
foreach (var item in basket.Items)