public async Task <IActionResult> Edit(int id, [Bind("TaskId,TaskTitle,TaskComment,TaskDate,TaskStatus")] Task task) { if (id != task.TaskId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(task); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TaskExists(task.TaskId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(task)); }
public async Task <IActionResult> Create([Bind("TaskId,TaskTitle,TaskComment,TaskDate,TaskStatus")] Task task) { if (ModelState.IsValid) { _context.Add(task); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(task)); }