public async Task <IActionResult> Edit(int id, [Bind("BrandID,ItemTypeID")] Component component) { if (id != component.BrandID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(component); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ComponentExists(component.BrandID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BrandID"] = new SelectList(_context.Brands, "BrandID", "BrandName", component.BrandID); ViewData["ItemTypeID"] = new SelectList(_context.ItemTypes, "ItemTypeID", "TypeName", component.ItemTypeID); return(View(component)); }
public async Task <IActionResult> Edit(int id, [Bind("ItemTypeID,TypeName")] ItemType itemType) { if (id != itemType.ItemTypeID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(itemType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ItemTypeExists(itemType.ItemTypeID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(itemType)); }
public async Task <IActionResult> Edit(int id, [Bind("BrandID,BrandName")] Brand brand) { if (id != brand.BrandID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(brand); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BrandExists(brand.BrandID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(brand)); }