0

I have a button for dequeuing my data from static variable, then I need to render a specific property on my view but for some reason I can't render it, the error message says
Object reference not set to an instance of an object.
maybe because it is null cuz I'm not yet enqueuing?, I guess? can someone provide an if statement? if thats the problem.

Here is my Controller :

public ActionResult BtnNext()
{
    var first = MyQueue.todayQueue.Dequeue();

    MyQueue.todayQueue.Count();

    TempData["QueueItem"] = first;

    return View("Index");
}

Here is my view:

    @{
        var item = (Rosh.QueueMe.Web.Models.MyQueue)TempData["QueueItem"];
    }
    <p>@item.QueueNumber</p>

0 Answers0