I have 2 Models a customer table and a product table. I am pretty new to MVC and I have created a model and I have the auto generated controller and views for details, delete, create... etc...
My models are:
[Table("Product")]
public class Product
{
[Key]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public int ProductId { get; set; }
public decimal Price { get; set; }
public int CustomerId { get; set; }
}
[Table("Customer")]
public class Customer
{
[Key]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public int CustomerId { get; set; }
public string Name { get; set; }
}
My question is, how do I display a list of the products based on the customer name. Obviously they are joined by CustomerId but how do I combine controllers. So I want to display some data based on data from another table.