为什么我的ModelState.AddModelError在我的索引方法中显示错误?

Why does my ModelState.AddModelError shows error in my index method?

I am new to C# and I encounter this error while doing my code in the HomeController.cs

 public async Task<ActionResult> Index(string searchString)
    {
        QnAQuery objQnAResult = new QnAQuery();
        try
        {
            if (searchString != null)
            {
                objQnAResult = await QueryQnABot(searchString);
            }
            return View(objQnAResult);
        }
        catch (Exception ex)
        {
            ModelState.AddModelError(string.Empty, "Error: " + ex);
            return View(objQnAResult);
        }
    }

And when I tried to build the code, there are errors shown in the link. And it says that The name "ModelState" does not exist in the context. And The name "View" does not exist in the context.

What could be the possible reason for having such problem? Thanks!