I want to filter data when Modifyon is null then on basis of createon orderby and when Modifyon is not null then orderby on modifyon
C#
async Task> IManager.GetApprovedUnapprovednotificationList(NotificationPagingSearch Items)
{
List _NotifyData = new List();
var DeptId = _authenticationManager.GetAuthenticatedUser().Result.DeptId;
try
{
_NotifyData = (from Notification in _dbContext.NotificationHeader
join MstStage in _dbContext.MstStage on Notification.Status equals MstStage.Id
where Notification.DeptId == (DeptId == 0 ? Notification.DeptId : DeptId)
&& Notification.Status == (Items.Status == 100 ? Notification.Status : Items.Status)
&& Notification.CreatedOn.Value.Date >= (Items.FromDate == string.Empty ? Notification.CreatedOn.Value.Date : ApplicationData.AppStringToDatetime(Items.FromDate))
&& Notification.CreatedOn.Value.Date x.CreatedOn).Select((k, index) => new NotifyData()
{
SrlNo = index + 1,
RefNId = k.RefNId,
NType = k.NType,
RoleName = GetUserTypeName(k.UserType).Result,
DeptId = k.DeptId,
DeptName = GetDepartmentName(k.DeptId).Result,
CourseId = k.CourseId,
CourseName = GetCourseName(k.CourseId).Result,
NotificationH = k.NotificationH,
NotificationB = k.NotificationB,
Comment = k.Comment,
StatusId = k.StatusId,
Status = k.Status,
CreatedBy = k.CreatedBy,
CreatedOn = ApplicationData.AppDateToString(k.CreatedOn),
ModifiedBy = k.ModifiedBy,
ModifiedOn = k.ModifiedOn,
Can_Approve = GetRegistationBtnAccessResult(_authenticationManager.GetAuthenticatedUser().Result.UserId, UserManageAccess.NotificationPage, UserManageAccess.NotificationApproveAction, k.RefNId).Result,
// Can_Save = GetRegistationResult(_authenticationManager.GetAuthenticatedUser().Result.UserId, UserManageAccess.NotificationPage, UserManageAccess.NotificationSendAction).Result
}).ToList();
}
catch (Exception ex)
{
}
return await Task.Run(() =>
{
return new PagedList(_NotifyData.AsQueryable(), Items.PageNumber, Items.PageSize);
});
}
Vishal JoshiRank #377 · 6.7K reputationPosted Apr 3, 2023, 4:48 AM EDT
Hello Sandeep
You can use ThenBy to order by multiple columns.
Thanks
Sandeep KumarRank #1,642 · 937 reputationPosted Apr 3, 2023, 5:58 AM EDT
Will it check Modifyon and createdon valye condition