public IActionResult MigrateCart([FromBody] MigrateCardViewModel model) { var cart = ShoppingCartRepository.GetCart(storeDB); cart.MigrateCart(model); return(Ok()); }
public void MigrateCart(MigrateCardViewModel model) { var shoppingCart = cartRepo.GetAll(model.OldCartId); foreach (Cart item in shoppingCart) { item.CartId = model.CartId; } cartRepo.Save(); }
// When a user has logged in, migrate their shopping cart to // be associated with their username public void MigrateCart(string currentCartId, string userName) { var model = new MigrateCardViewModel { OldCartId = currentCartId, CartId = userName }; var response = RequestHelper.Post(ShoppingCartAPI.MigrateCartURL, model); Console.WriteLine("Migrate result: " + response); }