public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Notes,CreationDate")] SAKType sAKType) { if (id != sAKType.ID) { return(NotFound()); } if (ModelState.IsValid) { try { sAKType.LastEditDate = DateTime.Now; _context.Update(sAKType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SAKTypeExists(sAKType.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(sAKType)); }
public async Task <IActionResult> Create([Bind("ID,Name,Notes")] SAKType sAKType) { if (ModelState.IsValid) { sAKType.CreationDate = DateTime.Now; _context.Add(sAKType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(sAKType)); }