public async Task <IActionResult> Edit(int id, [Bind("Id,AccessoryName,AccessoryPrice,Quantity")] MyAccessories myAccessories) { if (id != myAccessories.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(myAccessories); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MyAccessoriesExists(myAccessories.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(myAccessories)); }
public async Task <IActionResult> Create([Bind("Id,AccessoryName,AccessoryPrice,Quantity")] MyAccessories myAccessories) { if (ModelState.IsValid) { _context.Add(myAccessories); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(myAccessories)); }