c# - MVC Combine data from two different tables into one view -


lately have been trying mvc. finished mvc tutorial on asp.net website of microsoft. trying figure out how should apply following database design in model class (c#) code of application working on, experiencing trouble.

i want know how can add productcategory model:

database design

my model class:

namespace myprojectname.models {     public class shoppingcartitems     {         public virtual int id { get; set; }         [required]         [display(name="product name")]         public virtual string productname { get; set; }         //[display(name="category")]         //public virtual int categoryname { get; set; }         [display(name="date")]         public virtual datetime dateadded { get; set; }         [required]         [datatype(datatype.currency)]         public virtual decimal productprice { get; set; }         public virtual int amountavailable { get; set; }     } } 

shoppingcartitems should displays entries of products table. far know should possible scaffold of tables , display of products categories on 1 page.

can explain me how such mvc model class (or need add query controller class?) need in order show categories on index view belonging products displayed? should need make object of type categories , add properties?

yes, should create class category. product class should have list property.

when pass list of products view know categories have.

without more information on data layer technology using can't give more examples sorry.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -