public void MigrateCart(int customerId, string session) { var service = new Core.ShoppingCartService(_context.Instance); var sessionCart = service.FindBySessionId(session); if (sessionCart == null) { return; } var customerCart = service.FindByCustomerId(customerId); if (customerCart == null) { var customer = _context.Database.Repository <Kooboo.Commerce.Customers.Customer>().Find(customerId); customerCart = Kooboo.Commerce.Carts.ShoppingCart.Create(customer, session); service.Create(customerCart); } service.MigrateCart(sessionCart, customerCart); }
public void MigrateCart(int customerId, string session) { var service = new Core.ShoppingCartService(_context.Instance); var sessionCart = service.FindBySessionId(session); if (sessionCart == null) { return; } var customerCart = service.FindByCustomerId(customerId); if (customerCart == null) { var customer = _context.Database.Repository<Kooboo.Commerce.Customers.Customer>().Find(customerId); customerCart = Kooboo.Commerce.Carts.ShoppingCart.Create(customer, session); service.Create(customerCart); } service.MigrateCart(sessionCart, customerCart); }