public IActionResult Item(int id) { Product product = null; Category category = null; product = _allProducts.GetObjectProduct(id); category = _productCategories.AllCategories.FirstOrDefault(i => i.Id == product.CategoryId); var productObject = new ProductViewModel { Product = product, CurrentCategory = category.CategoryName }; return(View(productObject)); }
public IActionResult UpdateProduct(int id, string message) { var product = productRep.GetObjectProduct(id); for (int i = product.Imgs.Count; i < 6; i++) { product.Imgs.Add(new Photo()); } ViewBag.Category = categoryRep.GetAllSubcategories(); ViewBag.Manufacture = manufacturerRep.GetAlIManufacturers().ToList(); ViewBag.message = message; return(View(product)); }
public IActionResult Product(int id) { var product = productRep.GetObjectProduct(id); return(View(product)); }