Пример #1
0
        public void CheckoutCart(string address, string firstName, string lastName, string city, string country, string phoneNumber, string email)
        {
            var order = CreateOrder(address, firstName, lastName, city, country, phoneNumber, email);

            order = TransformCartToOrder(order);

            string userId = _userManager.GetUserId(_httpContextAccessor.HttpContext.User);
            User   user   = _appDbContext.Users.First(u => u.Id == userId);

            order.User = user;
            _shoppingCartManager.ClearCart();

            _appDbContext.SaveChanges();
        }