From 0c3cf30d2cd8576c7fcf00b893a3a810ea54ff67 Mon Sep 17 00:00:00 2001 From: Praburaj Date: Wed, 10 Sep 2014 11:26:29 -0700 Subject: [PATCH] Commenting the external logins from login cshtml to work around a bug https://github.com/aspnet/HttpAbstractions/issues/115 Also adding a work around for the EF issue. --- src/MusicStore/Models/ShoppingCart.cs | 17 +++++++++++++---- src/MusicStore/Views/Account/Login.cshtml | 5 +++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/MusicStore/Models/ShoppingCart.cs b/src/MusicStore/Models/ShoppingCart.cs index c45de53f41..c09c71c525 100644 --- a/src/MusicStore/Models/ShoppingCart.cs +++ b/src/MusicStore/Models/ShoppingCart.cs @@ -94,14 +94,23 @@ namespace MusicStore.Models public int GetCount() { + int sum = 0; //https://github.com/aspnet/EntityFramework/issues/557 // Get the count of each item in the cart and sum them up - int? count = (from cartItems in _db.CartItems - where cartItems.CartId == ShoppingCartId - select (int?)cartItems.Count).Sum(); + var cartItemCounts = (from cartItems in _db.CartItems + where cartItems.CartId == ShoppingCartId + select (int?)cartItems.Count); + + cartItemCounts.ForEachAsync(carItemCount => + { + if (carItemCount.HasValue) + { + sum += carItemCount.Value; + } + }); // Return 0 if all entries are null - return count ?? 0; + return sum; } public decimal GetTotal() diff --git a/src/MusicStore/Views/Account/Login.cshtml b/src/MusicStore/Views/Account/Login.cshtml index 27a628c27c..2ea1296491 100644 --- a/src/MusicStore/Views/Account/Login.cshtml +++ b/src/MusicStore/Views/Account/Login.cshtml @@ -52,11 +52,12 @@ } -
+ @*https://github.com/aspnet/HttpAbstractions/issues/115*@ + @*
@await Html.PartialAsync("_ExternalLoginsListPartial", new ExternalLoginListViewModel { ReturnUrl = ViewBag.ReturnUrl })
-
+
*@ @section Scripts { @*TODO : Until script helpers are available, adding script references manually*@