I have two models Invoice
and Product
, one invoice can have many products as usual.
public class InvoiceModel
{
public string Name { get; set; }
public string Description { get; set; }
[Required(ErrorMessage = "Products are required!")]
public List<ProductModel> Products { get; set; }
}
public class ProductModel
{
public string Name { get; set; }
public string Model { get; set; }
public string Brand { get; set; }
}
and i want to create a new invoice with products.
so when i generate razor page for invoice create, it only generate input fields for Name
and Description
,
then i added product table, and button to the form, when the user clicks on add product button, a new row is added to the table using jsscript.