I have now been stumped the last few hours trying to get this to work and have only been partially successful. I'm trying to create an order form where when you select a Panini you can have multiple toppings that are in the database from the Topping class, at the moment I can only get it to show a drop down and select 1 topping. Then I need to be able to have multiple paninis go into the Order class including the toppings for each panini. I have 3 classes:
Topping:
[Key]
public int ToppingId { get; set; }
public string Name { get; set; }
public decimal Price { get; set; }
public virtual ICollection<Panini> Panini { get; set; }
Panini
[Key]
public int PaniniId { get; set; }
public string Name { get; set; }
public decimal Price { get; set; }
public int ToppingId { get; set; }
public virtual Topping Topping { get; set; }
public virtual ICollection<Order> Order { get; set;
Order
[Key]
public int OrderId { get; set; }
public decimal TotalCost { get; set; }
public int PaniniId { get; set; }
public virtual Panini Panini { get; set; }
As I mentioned I can get the Pannini page to have a dropdown of the Toppings but I can only select one, but I need to be able to select a multiple of them. Same for the Order, I can get a dropdown of the available Paninis but can only select one.
Am I doing this the right way. If not can anybody point me in the right direction.
Many thanks.
Aucun commentaire:
Enregistrer un commentaire