// // GET: /NorthwindSvr/Details/5 public ActionResult DetailsProduct(int? id, AllProductsModel allProductsModel, SuppliersCategoriesModel model) { Product p = null; if (id != null) p = allProductsModel.ProductById(id.Value); else { p = allProductsModel.ProductById((int)TempData["id"]); } if (p.Supplier == null) p.Supplier = model.SupplierList.Where(s => s.SupplierID == p.SupplierID).DefaultIfEmpty(null).First(); if (p.Category == null) p.Category = model.CategoryList.Where(c => c.CategoryID == p.CategoryID).DefaultIfEmpty(null).First(); return View(p); }
// // GET: /NorthwindSvr/Edit/5 public ActionResult EditProduct(int id, AllProductsModel allProductsModel, SuppliersCategoriesModel suppliersCategoriesModel) { Product p = allProductsModel.ProductById(id); ViewBag.SuppliersCategoriesModel = suppliersCategoriesModel; return View(p); }