public async Task <IActionResult> Edit(int id, [Bind("TaskID,ProjectID,TaskName,TaskDescription,TaskStartDate,TaskDeadline,Completed")] Tasks tasks) { if (id != tasks.TaskID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tasks); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TasksExists(tasks.TaskID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Details", "Projects", new { id = tasks.ProjectID })); } return(View(tasks)); }
public async Task <IActionResult> Edit(int id, [Bind("ProjectID,UserID,ProjectName,ProjectDescription,ProjectDate")] Projects projects) { if (id != projects.ProjectID) { return(NotFound()); } if (ModelState.IsValid) { try { projects.UserID = _userManager.GetUserId(User); _context.Update(projects); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProjectsExists(projects.ProjectID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(projects)); }