public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Description,Status,AssigneeId,IssueId")] IssueTask issueTask) { if (id != issueTask.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(issueTask); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!IssueTaskExists(issueTask.Id)) { return(NotFound()); } else { throw; } } return(RedirectToParentIssue(issueTask.IssueId)); } ViewData["AssigneeId"] = issueTask.AssigneeId.HasValue ? new UserSelectList(_context.Users, issueTask.AssigneeId.Value) : new UserSelectList(_context.Users); ViewData["IssueId"] = new IssueSelectList(_context.Issues, issueTask.IssueId); ViewData["StatusId"] = new StatusSelectList(issueTask.Status); return(View(issueTask)); }
public async Task <IActionResult> Create([Bind("Id,Title,Description,Status,AssigneeId,IssueId")] IssueTask issueTask) { if (ModelState.IsValid) { _context.Add(issueTask); await _context.SaveChangesAsync(); return(RedirectToParentIssue(issueTask.IssueId)); } ViewData["AssigneeId"] = issueTask.AssigneeId.HasValue ? new UserSelectList(_context.Users, issueTask.AssigneeId.Value) : new UserSelectList(_context.Users); ViewData["IssueId"] = new IssueSelectList(_context.Issues, issueTask.IssueId); ViewData["StatusId"] = new StatusSelectList(issueTask.Status); return(View(issueTask)); }
public async Task <IActionResult> Edit(int?id) { if (id == null) { return(NotFound()); } var issueTask = await _context.IssueTasks.FindAsync(id); if (issueTask == null) { return(NotFound()); } ViewData["AssigneeId"] = issueTask.AssigneeId.HasValue ? new UserSelectList(_context.Users, issueTask.AssigneeId.Value) : new UserSelectList(_context.Users); ViewData["IssueId"] = new IssueSelectList(_context.Issues, issueTask.IssueId); ViewData["StatusId"] = new StatusSelectList(); return(View(issueTask)); }