Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

You should use MaxBy() from herehere, which is taken from MoreLINQ.

var items = rep.FindWhere(i => i.ID == itemID)
               .Select(i => i.Batch)
               .SelectMany(b => b.Items);

var NextItem = items.Where(i => i.StatusID == (short) ItemStatus.Pending)
                    .MaxBy(i => i.NumInBatch);

return NextItem.ID;
  

You should use MaxBy() from here, which is taken from MoreLINQ.

var items = rep.FindWhere(i => i.ID == itemID)
               .Select(i => i.Batch)
               .SelectMany(b => b.Items);

var NextItem = items.Where(i => i.StatusID == (short) ItemStatus.Pending)
                    .MaxBy(i => i.NumInBatch);

return NextItem.ID;
  

You should use MaxBy() from here, which is taken from MoreLINQ.

var items = rep.FindWhere(i => i.ID == itemID)
               .Select(i => i.Batch)
               .SelectMany(b => b.Items);

var NextItem = items.Where(i => i.StatusID == (short) ItemStatus.Pending)
                    .MaxBy(i => i.NumInBatch);

return NextItem.ID;
  
Source Link
Bobson
  • 1k
  • 5
  • 13

You should use MaxBy() from here, which is taken from MoreLINQ.

var items = rep.FindWhere(i => i.ID == itemID)
               .Select(i => i.Batch)
               .SelectMany(b => b.Items);

var NextItem = items.Where(i => i.StatusID == (short) ItemStatus.Pending)
                    .MaxBy(i => i.NumInBatch);

return NextItem.ID;