public async Task <IActionResult> Edit(int id, [Bind("Id,CreatedOn,Priority,BusinessDT,Title,Description,IsCommissioned,PrimaryOwnerId,SecondaryOwnerId,ReviewerId,TeamId")] Server.Models.Task task) { if (id != task.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(task); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TaskExists(task.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PrimaryOwnerId"] = new SelectList(_context.Employees, "Id", "Id", task.PrimaryOwnerId); ViewData["ReviewerId"] = new SelectList(_context.Employees, "Id", "Id", task.ReviewerId); ViewData["SecondaryOwnerId"] = new SelectList(_context.Employees, "Id", "Id", task.SecondaryOwnerId); ViewData["TeamId"] = new SelectList(_context.Teams, "Id", "Id", task.TeamId); return(View(task)); }
public async Task <IActionResult> Create( [Bind("Id,CreatedOn,Priority,BusinessDT,Title,Description,IsCommissioned,PrimaryOwnerId,SecondaryOwnerId,ReviewerId,TeamId")] Server.Models.Task task) { if (ModelState.IsValid) { _context.Add(task); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PrimaryOwnerId"] = new SelectList(_context.Employees, "Id", "Id", task.PrimaryOwnerId); ViewData["ReviewerId"] = new SelectList(_context.Employees, "Id", "Id", task.ReviewerId); ViewData["SecondaryOwnerId"] = new SelectList(_context.Employees, "Id", "Id", task.SecondaryOwnerId); ViewData["TeamId"] = new SelectList(_context.Teams, "Id", "Id", task.TeamId); return(View(task)); }