添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
On my very first project on ASP Core I have come across a trouble that strangely has not to have been resolved yet although seems quite simple.
On a details page of an Accounts Model I seek to have the table reflecting balances (transactions) entries, pertaining to the relevant account, in a descending date order:
public async Task<iactionresult> Details( string _SrcSys, string _CustId, string _AccId) if (_SrcSys == null || _CustId == null || _AccId == null ) return NotFound(); // The three are Composite Key elements var Accs = await _context.Accounts .Include(Bal => Bal.Balances) .OrderBy(Bal => Bal.Balances.OrderByDescending(x => x.RepDt)) // Why isn't this sorting the result? .SingleOrDefaultAsync(x => x.SrcSys == _SrcSys && x.CustId == _CustId && x.AccId == _AccId); return View(Accs);
What could be the error? The portion in simple words is that why doesn't .OrderBy(Bal => Bal.Balances.OrderByDescending(x => x.RepDt)) help in having the balances table be sorted on the Accounts' Details Page?
Please help!
What I have tried:
The code in many shapes and question placed searched on google, but can't find any help.
  • Read the question carefully.
  • Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  • If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  • Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question. Let's work to help developers, not make them feel stupid.
  •