Merge branch 'release' into dev

This commit is contained in:
David Obando 2016-05-12 16:32:47 -07:00
Родитель 2314512ac7 e3096322ae
Коммит ef92bf3834
2 изменённых файлов: 17 добавлений и 7 удалений

Просмотреть файл

@ -76,19 +76,29 @@ namespace MusicStore.Controllers
.Include(c => c.Album)
.SingleOrDefaultAsync();
// Remove from cart
int itemCount = cart.RemoveFromCart(id);
string message;
int itemCount;
if (cartItem != null)
{
// Remove from cart
itemCount = cart.RemoveFromCart(id);
await DbContext.SaveChangesAsync(requestAborted);
await DbContext.SaveChangesAsync(requestAborted);
string removed = (itemCount > 0) ? " 1 copy of " : string.Empty;
string removed = (itemCount > 0) ? " 1 copy of " : string.Empty;
message = removed + cartItem.Album.Title + " has been removed from your shopping cart.";
}
else
{
itemCount = 0;
message = "Could not find this item, nothing has been removed from your shopping cart.";
}
// Display the confirmation message
var results = new ShoppingCartRemoveViewModel
{
Message = removed + cartItem.Album.Title +
" has been removed from your shopping cart.",
Message = message,
CartTotal = await cart.GetTotal(),
CartCount = await cart.GetCount(),
ItemCount = itemCount,

Просмотреть файл

@ -54,7 +54,7 @@ namespace MusicStore.Models
public int RemoveFromCart(int id)
{
// Get the cart
var cartItem = _dbContext.CartItems.Single(
var cartItem = _dbContext.CartItems.SingleOrDefault(
cart => cart.CartId == _shoppingCartId
&& cart.CartItemId == id);