I am using below linq, in which date parameter is not working properly.
I am facing issue, that when i filter data on date between, then relevant data does not come accordingly date.
If i remove join and then filter data on date between, then relevant data get display accordingly date.
View
@model IEnumerable<ERP_APP.Models.BBDetailView>
@{
}
<div class="card">
<div class="card-header">
<div class="text-sm">
<div class="card-title">Item List</div>
</div>
</div>
<div class="card-body">
@Html.ActionLink("Create New", "CreaterEmployee", null, new { @class = "btn btn-primary" })
@using (Html.BeginForm("BBDetail", "BigBale", FormMethod.Post))
{
<hr />
<div class="form-horizontal">
<div class="form-group form-group-sm">
<div class="col-md-8">
@*<input name="start" type="date" id="datepicker" class="form-control" />*@
<input name="start" type="date" id="start" class="form-control" value="@Request["start"]" />
</div>
</div>
<div class="form-group form-group-sm">
<div class="col-md-8">
<input name="end" type="date" id="end" class="form-control" value="@Request["end"]" />
@*<input name="end" type="date" id="datepicker" class="form-control" />*@
</div>
</div>
<div class="form-group-sm">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Get" onclick="SubmitForm()" class="btn btn-default" /> <span> </span>
</div>
</div>
</div>
}
<table class="table table-striped my-4 w-100" id="datatable2">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.itemname.Descriptionitem)
</th>
<th>
@Html.DisplayNameFor(model => model.section.Secnam)
</th>
<th>
@Html.DisplayNameFor(model => model.probale.EntryDate)
</th>
<th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.itemname.Descriptionitem)
</td>
<td>
@Html.DisplayFor(modelItem => item.section.Secnam)
</td>
<td>
@Convert.ToDateTime(item.probale.EntryDate).ToString("dd/MM/yyyy")
</td>
<td>
@Html.ActionLink("Edit", "EditItem", new { codiitem = item.itemname.CodeItem }, new { @class = "btn btn-warning" }) |
@Html.ActionLink("Delete", "Delete", new { }, new { @class = "btn btn-danger" })
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
public ActionResult BBDetail(DateTime? start, DateTime? end)
{
var list = new List<ProbaleMV>();
List<ItemMasterFile> tblitem = DB.ItemMasterFiles.ToList();
List<Section> tblsection = DB.Sections.ToList();
List<Catagory> tblcategory = DB.Catagories.ToList();
List<Probale> tblprobale = DB.Probales.ToList();
var bbigbalerecord = from e in tblprobale
where e.EntryDate >= start && e.EntryDate <= end && e.DelID != null
join d in tblitem on e.Codeitem equals d.CodeItem into table1
from d in table1.ToList()
join i in tblsection on e.SecID equals i.SecID into table2
from i in table2.ToList()
join c in tblcategory on e.CID equals c.CID into table3
from c in table3.ToList()
select new BBDetailView
{
probale = e,
itemname = d,
section = i,
catagory = c
};
return View(bbigbalerecord);
}