I don t know how to put CustomerData
into CustomerLists
property. I m already using CustomerLists = CustomerData;
but I got error:
CustomerLists is a type but is used like a variable
Can anyone explain this to me?
This is my code in Index.cshtml.cs:
namespace WebApplication1.Pages
{
public class Pages : PageModel
{
public List<CustomerList> CustomerLists = new List<CustomerList>();
private readonly ApplicationDbContext _conn;
public Pages(ApplicationDbContext conn)
{
_conn = conn;
}
public int Message;
public void OnGet()
{
var CustomerData = _conn.table_customer.ToList();
//??
}
}
public class CustomerList
{
public string CustomerId;
public string Name;
public string Address;
public string MobileNo;
}
}