public ActionResult Add() { ViewBag.Brands = DataLists.ProductBrandsWithDescription(); ViewBag.Descriptions = DataLists.ProductDescription(0); return(View(new InventoryAddViewModel())); }
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)); }