public async Task <IActionResult> Create([Bind("StockId,ModelModelName,ModelModelYear,Qty")] Inventory inventory) { if (ModelState.IsValid) { _context.Add(inventory); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ModelModelName"] = new SelectList(_context.Model, "ModelName", "ModelName", inventory.ModelModelName); return(View(inventory)); }
public async Task <IActionResult> Create([Bind("ModelName,ModelYear,Horsepower,Torque,Category,Price,ManufacturerMake")] Model model) { if (ModelState.IsValid) { db.Add(model); await db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ManufacturerMake"] = new SelectList(db.Manufacturer, "Make", "Make", model.ManufacturerMake); return(View(model)); }