예제 #1
0
        private async Task CreateOrder(AppIdentityUser user)
        {
            var customerBasket = await basketRepository.GetBasketAsync(user.Id);

            var items = customerBasket.Items
                        .Select(i =>
                                new OrderItem(i.ProductId, i.ProductName, i.UnitPrice, i.Quantity))
                        .ToList();

            var order = new Order(items, user.Id, user.Name, user.Email, user.Phone, user.Address, user.AdditionalAddress,
                                  user.District, user.City, user.State, user.ZipCode);

            await checkoutRepository.CreateOrUpdate(order);

            await basketRepository.DeleteBasketAsync(user.Id);
        }