The goal
Count the results returned from a stored procedure.
The problem
I have the following code on my ProductsController
:
[HttpGet]
public ActionResult DailyOffers()
{
var productsList = Products.BuildOffersList();
ViewBag.Title = String.Format("Ofertas de hoje ({0:dd/MM/yyyy})",
DateTime.Now);
ViewBag.CategoryProductsQuantity = ??;
ViewBag.CurrentCategory = "Daily-Offers";
return View(productsList);
}
As you can see, there is a builder on this method. This builder returns the Stored Procedure result. And I want to count the number of results that this procedure returns.
What I'm thinking about
Maybe this?:
ViewBag.CategoryProductsQuantity = productsList.Count;
Technical details
I'm using C#.NET + MySql + Entity Framework 5 + Razor Engine.