0

I'm Building A Queue System, and want to click a button "Next" "CallAgain" and "NoShow" as of now when I click my "Next" Button, it only shows the first record from my database. I'm quite stuck right now , I want to click the "Next" Button over and over again and show me the next record.

public PartialViewResult BtnNext(int current = 0)
        {
            System.Threading.Thread.Sleep(1000);
            var model = db.Queues.OrderBy(x => x.QueueNumber).Skip(current).Take(1);
            return PartialView("_queuenumber", model);
        }

I expect to click this button over and over again and will show me the next record from the database whenever I click it, thankyou. (super newbie)

Carlo Toribio
  • 137
  • 11
  • looks good to me, have you tried debugging it? Does the int current parameter change? My bet is that you don't send any value to it and it defaults to zero... – netchkin May 06 '19 at 06:13
  • well that code is actually working. When I click "Next" button it shows me the first data on my database right? but I want to click it again to show my second data. – Carlo Toribio May 06 '19 at 06:27
  • are you saying that on second click, current actually contains 1? And on third click, there is 2 in the current parameter? – netchkin May 06 '19 at 09:25
  • yes thats it, thats my problem. I'm stuck there, no idea how to implement that – Carlo Toribio May 07 '19 at 01:47
  • and do you know what is the actual query that's being run against your database? can you use `ToTraceString` as menitoned here https://stackoverflow.com/questions/1412863/how-do-i-view-the-sql-generated-by-the-entity-framework to see what actually happens? – netchkin May 08 '19 at 12:09

0 Answers0