I'm new to using Razor pages, so I have in the model directory a class with the following values:
public int Id { set; get; }
public string CustomerCode { set; get; }
public double Amount { set; get; }
Inside my controller (.cs file), I have the following:
public ActionResult Index()
{
Customer objCustomer = new Customer();
objCustomer.Id = 1001;
objCustomer.CustomerCode = "C001";
objCustomer.Amount = 900.78;
return View();
}
...now, I want to display the values via my Index.cshtml page, but when I run the application, I just get the actual code that I typed as oppose to the values:
...this is how have the .cshtml page setup:
@model Mvccustomer.Models.Customer
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<div>
The customer id is : <%= Model.Id %> <br />
The customer id is : <%= Model.CustomerCode %> <br />
The customer id is : <%= Model.Amount %> <br />
</div>
...my question is, how do I get the values to display? Thanks in advance for any assistance.