.NET Fiddle

CSharp · Mvc

Model

using System;
using System.ComponentModel.DataAnnotations;

namespace HelloWorldMvcApp
{
	public class YourCustomModelClass 
{
   public DateTime Fecha {set; get;}
   public int Count {set; get;}
}

public class Inventory 
{
   public DateTime FechaEntrega {set; get;}
   public int Modelo {get;set;}
}
}

View

@model IEnumerable<HelloWorldMvcApp.YourCustomModelClass>
@{
	Layout = null;
}

<!DOCTYPE html>
<!-- template from http://getbootstrap.com/getting-started -->

<html lang="en">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>Bootstrap 101 Template</title>

		<!-- CSS Includes -->
		<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
		
		<style type="text/css">

			.field-validation-error {
				color: #ff0000;
			}

		</style>
	</head>
	
	<body>
		<div class="container">
			<div class="col-md-6 col-md-offset-3">
				<h1>Hello Stranger</h1>
	
			<div><b>Table Format Data Displaying in ForEach</b><br /></div>  
<table class="table table-bordered table-responsive table-hover">  
    <tr>  
        <th>Fecha</th>  
        <th>Count </th>  
		
    </tr>  
	@Model.Count()
    @foreach (var d in Model)  
    {  
       <tr>  
        <th>@d.Fecha</th>  
        <th>@d.Count </th>  
		
    </tr> 
    }  
	</table>
				
			</div>
		</div>

		<!-- JS includes -->
		<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
		<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
	
		<script src="//ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
		<script src="//ajax.aspnetcdn.com/ajax/mvc/4.0/jquery.validate.unobtrusive.min.js"></script>
		
		<script type="text/javascript">
		
			

		</script>
	</body>
</html>

Controller

using System;
using System.Web.Mvc;
using System.Collections.Generic;
using System.Linq;
using System.Collections;

namespace HelloWorldMvcApp
{
	public class HomeController : Controller
	{
		[HttpGet]
		public ActionResult Index()
		{
		   //Sample Data
			var Inventary = new List<Inventory>()
			{new Inventory()
			{  FechaEntrega = System.DateTime.Now.Date.AddYears(-10)  , Modelo =0
			},
			new Inventory()
			{  FechaEntrega = System.DateTime.Now.Date.AddYears(-10)  , Modelo =0
			}
			,
			
			new Inventory()
			{  FechaEntrega = System.DateTime.Now.Date.AddYears(-11)  , Modelo =0
			}};
			
			var model =  Inventary.Where(m => m.Modelo == 0)
                         .Where(f  => f.FechaEntrega.Year > 2005)
                         .GroupBy( e => e.FechaEntrega.Date)
                         .Select(p=> new YourCustomModelClass 
                          {
                              Fecha  =  p.Key,
                              Count  = p.Count()
                          });
			
			
			return View(model);
		}
	}
}
;