public async Task <IActionResult> Edit(int id, [Bind("id,StoreName,Address")] AutoPartsStore autoPartsStore) { if (id != autoPartsStore.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(autoPartsStore); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AutoPartsStoreExists(autoPartsStore.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(autoPartsStore)); }
public async Task <IActionResult> Create([Bind("id,StoreName,Address")] AutoPartsStore autoPartsStore) { if (ModelState.IsValid) { _context.Add(autoPartsStore); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(autoPartsStore)); }