public ActionResult Index() { List <Product> list = new List <Product>(); foreach (Product item in productService.GetAll()) { item.CatagoryName = catagoryService.Get(item.CatagoryId).CatagoryName; list.Add(item); } return(View(list)); }
public ActionResult Index() { List <Product> productList = new List <Product>(); List <int> itemList = Session["CART"] as List <int>; foreach (int item in itemList) { Product p = productService.Get(item); p.CatagoryName = catagoryService.Get(p.CatagoryId).CatagoryName; productList.Add(p); } return(View(productList)); }
public ActionResult MyPurchase(int id) { List <Product> list = new List <Product>(); foreach (BuyerPurchase item in purchaseService.GetAll()) { if (item.BuyerId == id) { Product p = productService.Get(item.ProductId); p.Date = item.Date; p.CatagoryName = catagoryService.Get(p.CatagoryId).CatagoryName; list.Add(p); } } return(View(list)); }