【发布时间】:2020-01-22 04:46:38
【问题描述】:
我想根据 CreatedUtc 时间对数据进行排序。我曾尝试使用 Reverse 功能,它似乎可以解决,但仍在寻找一些替代选项。
var result = _participantRepo.AsQueryable().Where(x => x.Id == ParticipantId).SelectMany(x =>
x.Relations).ToList().Where(x => x.UserId != AppUserId).Select(r => new RelationVM
{
IsOwner = r.UserId == participant.CreatedByUserId,
FirstName = r.FirstName,
LastName = r.LastName,
Email = r.Email,
UserId = r.UserId,
RelationType = r.RelationType,
Role = r.Role,
IsAccepted = r.IsAccepted,
AvatarUrl = r.AvatarUrl,
CreatedUtc = r.CreatedUtc
}).Reverse().ToList();
【问题讨论】:
标签: c# mongodb-query