// GET: Product public ActionResult ProductDetails(string productIDStr) { int id = 1; if (int.TryParse(productIDStr, out id)) { id = int.Parse(productIDStr); } ProductDAL productDal = new ProductDAL(); Product product = productDal.getProductById(id); CatalogueDAL catalogueDal = new CatalogueDAL(); Catalogue catalogue = catalogueDal.getCatalogueById(product.Catalogue_ID); catalogueDal.getAllProductsByCatalogue(catalogue); List <Catalogue> catalogues = catalogueDal.getAllCatalogues(); ProductDetailsModel productDetails = new ProductDetailsModel { ProductCatalogue = catalogue, ProductDetails = product, Catalogues = catalogues, }; return(View(productDetails)); }
public ActionResult Catalogue(string IDStr) { int ID = 1; if (int.TryParse(IDStr, out ID)) { ID = int.Parse(IDStr); } CatalogueDAL catalogueDal = new CatalogueDAL(); Catalogue catalogue = catalogueDal.getCatalogueById(ID); catalogueDal.getAllProductsByCatalogue(catalogue); return(View(catalogue)); }