private async Task CreateCart(string username) { var user = await userManager.FindByNameAsync(username); Cart cart = new Cart() { UserId = user.Id }; var createdCart = await cartRepo.Create(cart); if (createdCart != null) { user.CartId = createdCart.Id; await userManager.UpdateAsync(user); } }