@if (Model.LastOrder != null)
{
<h3>Lorem ipsum:</h3>
}
else
{
<h3>Lorem lorem!</h3>
} -> here occurs error
With this code, I get an error nullreferenceexception
. Everything could be easy to resolve, but error occurs at... last bracket! Very strange.. and what is more - nothing special is in error info to help me.
Why I get this error?
Here is my controller action:
[Authorize]
public ActionResult Dashboard()
{
XYZ toReturn = new XYZ { };
return View(toReturn);
}