my data table name is called Shift its data is like below
i use below syntax to get the last added value
Shiftlast = _db.Shift.OrderByDescending(c => c.Id).First(); ---the result is 3500
my question is how to get also the before last and before before last values also which is 2500 and and 152,i need each value to be get in variable as below
Shiftlast = _db.Shift.OrderByDescending(c => c.Id).First();
Shiftbeforelast = _db.Shift.OrderByDescending(c => c.Id).??;
Shiftbeforebeforelast = _db.Shift.OrderByDescending(c => c.Id).??;
What type of variable is Shifts? Maybe is List<T>
and you need to add .ToList();
Shifts = _db.Shift.OrderByDescending(c => c.Id).Take(3).ToList();