public ActionResult Edit(int id) { ViewBag.Categories = DataLists.Categories(); ViewBag.Brands = DataLists.ProductBrands(); Product product = Product.GetById(id); ProductAddEditViewModel model = new ProductAddEditViewModel(product.Id, product.CategoryId, product.BrandId, product.Description); return(View(model)); }
public ActionResult Edit(int id) { Inventory inventory = Inventory.GetById(id); Product product = Product.GetById(inventory.ProductId); ViewBag.Categories = DataLists.Categories(); ViewBag.Brands = DataLists.ProductBrandsWithDescription(); ViewBag.Descriptions = DataLists.ProductDescription(product.BrandId); InventoryEditViewModel model = new InventoryEditViewModel() { Id = inventory.Id, BrandId = product.BrandId, Description = product.Description, PricePaidPerUnit = inventory.PricePaidPerUnit, UnitsPurchased = inventory.UnitsPurchased, UnitsSold = inventory.UnitsSold, CategoryId = product.CategoryId }; return(View(model)); }
public ActionResult Add() { ViewBag.Categories = DataLists.Categories(); ViewBag.Brands = DataLists.ProductBrands(); return(View(new ProductAddEditViewModel())); }