public async Task <IActionResult> Edit(int id, [Bind("Id,PagAction,pagTitle")] Action action) { if (id != action.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(action); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ActionExists(action.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(action)); }
public async Task <IActionResult> Create([Bind("Id,PagAction,pagTitle")] Action action) { if (ModelState.IsValid) { _context.Add(action); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(action)); }