public async Task <IActionResult> Edit(int id, [Bind("Id,VendorItemId")] VendorItemTypeValue vendorItemTypeValue) { if (id != vendorItemTypeValue.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(vendorItemTypeValue); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VendorItemTypeValueExists(vendorItemTypeValue.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["VendorItemId"] = new SelectList(_context.VendorItems, "Id", "Id", vendorItemTypeValue.VendorItemId); return(View(vendorItemTypeValue)); }
public async Task <IActionResult> Create([Bind("Id,VendorItemId")] VendorItemTypeValue vendorItemTypeValue) { if (ModelState.IsValid) { _context.Add(vendorItemTypeValue); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["VendorItemId"] = new SelectList(_context.VendorItems, "Id", "Id", vendorItemTypeValue.VendorItemId); return(View(vendorItemTypeValue)); }