I am new in MVC. I want list view to generate by passing Date Parameter in controller; But I got error please help me solve the problem. my controller code is
- LPDBContext DB = new LPDBContext();
- var items = db.Processes.Where(x =>x.PRDate.ToShortDateString().Equals(08 / 09 / 2018)).ToList();
- return View(items);
- @model IEnumerable<EasyApp.Models.Process>
- @{
- ViewBag.Title = "ExportP3List";
- Layout = "~/Views/Shared/_Layout.cshtml";
- }
- <div class="EasyViewDiv table-responsive">
- <h2>Cuttingh2>
- <table style="font-size:smaller;" class="table table-bordered">
- <tr>
- <th>
- Production Date
- th>
- <th>
- In-Out Time
- th>
- <th>
- Employer
- th>
- <th>
- Operator Name
- th>
- <th>
- WO No
- th>
- <th>
- OD
- th>
- <th>
- Thk
- th>
- <th>
- Specification
- th>
- <th>
- Pipe No
- th>
- <th>
- Length
- th>
- <th>
- MT
- th>
- <th>
- Actual Meter
- th>
- <th>
- Time Taken
- th>
- <th>
- Speed
- th>
- tr>
- @foreach (var item in Model)
- {
- <tr>
- <td>
- @Html.DisplayFor(modelItem => item.PRDate)
- td>
- <td>
- @Html.DisplayFor(modelItem => item.Atten.INTIME) TO @Html.DisplayFor(modelItem => item.Atten.OUTIME)
- td>
- <td>
- @Html.DisplayFor(modelItem => item.Atten.Emp.CompanyID)
- td>
- <td>
- @Html.DisplayFor(modelItem => item.Atten.Emp.EmpName)
- td>
- <td>
- @Html.DisplayFor(modelItem => item.PipeAl.Order.WONO)
- td>
- <td>
- @Html.DisplayFor(modelItem => item.PipeAl.Order.DIA)
- td>
- <td>
- @Html.DisplayFor(modelItem => item.PipeAl.Order.THK)
- td>
- <td>
- @Html.DisplayFor(modelItem => item.PipeAl.Order.PISPEC)
- td>
- <td>
- @Html.DisplayFor(modelItem => item.PIPENO)
- td>
- <td>
- @Html.DisplayFor(modelItem => item.PipeAl.LENGTH)
- td>
- <td>
- @Html.DisplayFor(modelItem => item.PipeAl.MT)
- td>
- <td>
- @Html.DisplayFor(modelItem => item.ActualMeter)
- td>
- <td>
- @Html.DisplayFor(modelItem => item.CuttingTime)
- td>
- <td>
- @Html.DisplayFor(modelItem => item.CuttingSpeed)
- td>
- tr>
- }
- table>
- div>
I got following error
LINQ to Entities does not recognize the method 'System.String ToShortDateString()' method, and this method cannot be translated into a store expression.

Raju FodsePosted Sep 16, 2018, 10:47 PM
Hi All,
Ultimately I succeed to passing List view in MVC with “Hardcoded” Date Parameter
Raju FodsePosted Sep 11, 2018, 4:17 AM
Piyush PansuriyaPosted Sep 11, 2018, 12:38 AM
Raju FodsePosted Sep 10, 2018, 2:15 AM
LINQ to Entities does not recognize the method 'System.DateTime Parse(System.String)' method, and this method cannot be translated into a store expression.
Vivek KumarPosted Sep 10, 2018, 1:58 AM
Piyush PansuriyaPosted Sep 10, 2018, 12:41 AM