aspnet / MusicStore

[Archived] MusicStore test application that uses ASP.NET/EF Core. Project moved to https://github.com/aspnet/AspNetCore
1.3k stars 878 forks source link

Remove from cart link doesn't work #714

Closed natelaff closed 7 years ago

natelaff commented 7 years ago

I can't get the remove from cart link to execute anything. What's missing?

natelaff commented 7 years ago

Well you seem to have fixed this by adding the missing data-url attribute to the delete link. This removes the cart item, but does not show the confirmation message or remove the row. have to refresh the page to see the cart item has been removed.

natelaff commented 7 years ago

Ok, I got it. But I don't know why (as I'm just learning about ajax and jquery and all this). When you pass the view model back as JSON, you're doing this..

                    $('#cart-total').text(data.CartTotal);
                    $('#update-message').text(data.Message);
                    $('#cart-status').text(data.CartCount);

The issue I've found is that this is getting converted to camel case (I assume by JSON) and these values are undefined. Instead they must be

                    $('#cart-total').text(data.cartTotal);
                    $('#update-message').text(data.message);
                    $('#cart-status').text(data.cartCount);

So... maybe I'm just missing something where ASP.NET Core should be resolving all of this stuff, or its just a typo in the ShoppingCart/Index page. Either way should be addressed :)

natemcmaster commented 7 years ago

This was resolved in https://github.com/aspnet/MusicStore/pull/762.