I'm currently making some exercises regarding displaying some tables in ASP.NET application. I Have following model class:
public class DynamoDB
{
public IEnumerable<string> GetOsman { get; set; }
}
and controller class:
public class DynamoController : Controller
{
// --- THIS PART IS UPDATED ---
public ActionResult Index()
{
DynamoDB model = new DynamoDB();
model.GetOsman = LoadAI();
return View(model);
}
public List<string> LoadAI()
{
List<string> list = new List<string>();
list.Add("Testing");
list.Add("MCV");
list.Add("Project");
return list;
}
}
and finally my Razor file:
@{
ViewBag.Title = "Home Page";
}
@model FinalApplication.Models.DynamoDB
<div class="jumbotron">
<h1>Home Monitoring Application</h1>
</div>
@foreach (var item in Model.GetOsman)
{
<text>
@item
</text>
}
But it still returns the error "Object reference not set to an instance of an object" at following line:
@foreach (var item in Model.GetOsman)
I made a similar post yesterday, since I got the same error when I was accessing the data from a DynamoDB table, but I'm getting the same error even with this simple example. My solution explorer look like this:

return View(model.GetOsman);toreturn View(model);You need to send the complete model.