I'm not sure where to sort the title at, would that be at the view level or in the repository?
i tried setting it in the repository but that doesn't seem to work
public IEnumerable<DocumentEntity> FindPoliciesDocuments() { return DbContext .Set<DocEntity>() .Include(d => d.EgendaFile) .Where(d => d.EgendaDocumentTypeEntity.Id == (int)EgendaDocumentType.Policies) .Where(d => d.IsDeleted == false || d.IsDeleted == null).AsEnumerable() .OrderByDescending(d => d.Title); }
View which sorts the date but not the title which is what I want it to sort by.
<div class="tab-container"><table id="documentsTable_@Model.Source" class="table table-striped table-bordered display responsive nowrap" style="width: 100%"><thead><tr> @{ if (!@Model.IsUserView) {<th class="all">Action</th> } else {<th class="all th-hide-column"></th> } }<th class="all">Title</th><th class="all">Date</th></tr></thead><tbody> @foreach (var document in Model.Documents) {<tr id="row_@document.Id"> @{ if (!@Model.IsUserView) {<td><a data-toggle="modal" data-id=@document.Id data-documentType="@Model.Source" data-target="#delete-document-modal" class="btn btn-danger delete-document"><i class="fa fa-trash fa-fw" title="Delete" style="color: white"></i></a><a asp-controller="Document" asp-action="EditDocument" asp-route-id="@document.Id" asp-route-documentType="@Model.Source" class="btn btn-info"><i class="fa fa-pencil fa-fw" title="Edit" style="color: white"></i></a><a id="view-packet-item-file" class="btn btn-secondary" target="_blank" asp-area="" asp-controller="File" asp-action="Download" asp-route-documentId="@document.Id" asp-route-source="@Model.Source"><i class="fa fa-file-pdf-o fa-fw" aria-hidden="true" title="View" style="color: black"></i></a></td><td>@document.Title</td> } else {<td class="td-hide-column"></td><td> @{ if (@document.EgendaFile == null) { } } <a id="view-packet-item-file" asp-area="" asp-controller="File" asp-action="DownloadFile" asp-route-fileId="@document.EgendaFile?.Id" target="_blank"> @document.Title</a></td> } } @{ var sortingDate = DateTime.MaxValue.ToLongDateString(); if (document.Date != null) { sortingDate = ((DateTime) document.Date).ToString("yyyyMMdd"); }<td data-order="@sortingDate">@document.Date.ToString("d")</td> }</tr> }</tbody></table></div>