I have the following code in my .cs file:
public class ClientCredentialsModel : PageModel
{
[BindPropertyAttribute]
public BusinessUnit businessUnit { get; set; }
public void OnGet()
{
BusinessUnit businessUnit = new BusinessUnit();
businessUnit.Name = "Tessla";
}
}
And
public class BusinessUnit
{
public string Id { get; set; }
public string Name { get; set; }
public string AddressName { get; set; }
public string EmailAddress { get; set; }
public string PostCode { get; set; }
}
..which should allow me to access the object's properties in my Razor view as:
<p>Name: @Model.businessUnit.Name</p>
However, I keep getting the following error: