I want to Add product and News ( Two models) with in a single view
Please help me with simple login
News.cs In Model Folder
public class News
{
public int NewsID { get; set; }
public string NewsItem { get; set; }
}
Product.cs In Model Folder
public class Product
{
public int ProdID { get; set; }
public string ProdName { get; set; }
public string ProdManufacturer { get; set; }
public Decimal ProdPrice { get; set; }
public DateTime? ProdManufacturingDate { get; set; }
public DateTime? ProdExpiryDate { get; set; }
}
HomeController
#region "product data Object"
IEnumerable<Product> product = new List<Product>
{
new Product(){ProdID=1,ProdName="Pavilion dv2z",ProdManufacturer="H P",ProdPrice=1123.09M },
new Product(){ProdID=2,ProdName="Inspiron",ProdManufacturer="Dell",ProdPrice=1223.29M },
new Product(){ProdID=3,ProdName="MacBook",ProdManufacturer="Apple",ProdPrice=3123.43M },
new Product(){ProdID=4,ProdName="MacBook Air",ProdManufacturer="Apple",ProdPrice=4123.10M },
new Product(){ProdID=5,ProdName="MacBook Pro",ProdManufacturer="Apple",ProdPrice=4123.89M },
new Product(){ProdID=6,ProdName="Mac Mini",ProdManufacturer="Apple",ProdPrice=2235.87M },
new Product(){ProdID=7,ProdName="Sonic F15",ProdManufacturer="Vivo",ProdPrice=1236.09M },
new Product(){ProdID=8,ProdName="Yoga Series",ProdManufacturer="Lenovo",ProdPrice=2123.39M },
new Product(){ProdID=9,ProdName="Galaxy Note Series",ProdManufacturer="Samsung",ProdPrice=9123.60M },
new Product(){ProdID=10,ProdName="Galaxy Note 10.1",ProdManufacturer="Samsung",ProdPrice=5123.78M },
new Product(){ProdID=11,ProdName="VivoBook S200E",ProdManufacturer="Asus",ProdPrice=1293.29M },
new Product(){ProdID=12,ProdName="Aspire E",ProdManufacturer="Acer",ProdPrice=1238.11M}
};
#endregion
#region "News Data Object"
IEnumerable<News> news = new List<News>()
{
new News{NewsID=1,NewsItem="IPL 2016, KKR vs KXIP: We knew 160 was defendable on this ground, says Andre Russell"},
new News{NewsID=2,NewsItem="Apple hires Google X lab co-founder for health projects"},
new News{NewsID=3,NewsItem="Planet Nine' may not exist, scientists say"},
new News{NewsID=4,NewsItem="Soon, a botanical drug to cure dengue!"},
};
#endregion
#region "Index Controller"
public ActionResult Index()
{
IEnumerable<Product> prd = product.ToList();
return View(prd);
}
#endregion
Please Help me to show both model class data with in a single View