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

fix remove from cart ajax done #762

Closed kimbaudi closed 7 years ago

kimbaudi commented 7 years ago

This pull request fixes an issue with RemoveFromCart. Currently, the RemoveFromCart method in ShoppingCartController returns a ShoppingCartRemoveViewModel as a JsonResult that has properties which are PascalCase (i.e., Message, CartTotal, CartCount, ItemCount, DeleteId). However, the jQuery ajax call gets the data as camelCase (i.e., message, cartTotal, cartCount, itemCount, deleteId). As a result, removing an item from the cart isn't working correctly. Changing the JSON from PascalCase to camelCase fixes the problem.

dnfclas commented 7 years ago

This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. We will now review your pull request. Thanks, .NET Foundation Pull Request Bot

Eilon commented 7 years ago

@kimbaudi thanks for sending this updated PR. I wonder if this has been broken for a long time when MVC changed the default JSON serialization to use camelCase instead of PascalCase?

kimbaudi commented 7 years ago

@Eilon I believe MVC recently started using camelCase by default since 1.1.0 (so not too long ago).

Eilon commented 7 years ago

Actually it was changed right before 1.0.0 RTM: https://github.com/aspnet/Announcements/issues/194

Anyway, the change looks good, so I'll merge!