public async Task <IActionResult> Edit(int id, [Bind("TeaStoreID,Name,Url")] TeaStore teaStore) { if (id != teaStore.TeaStoreID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(teaStore); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeaStoreExists(teaStore.TeaStoreID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(teaStore)); }
public async Task <IActionResult> Create([Bind("TeaStoreID,Name,Url")] TeaStore teaStore) { if (ModelState.IsValid) { _context.Add(teaStore); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(teaStore)); }