public async Task <IActionResult> Edit(int id, [Bind("PrcCompleted,Budget,StartDate,EstimatedEndDate,ActualEndDate,Spent,ID,Name,Description,ProjectID")] PSTS6.Models.Task task) { if (id != task.ID) { return(NotFound()); } if (ModelState.IsValid) { try { await _repo.UpdateTask(task); } catch (DbUpdateConcurrencyException) { if (!TaskExists(task.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Edit", "Projects", new { id = task.ProjectID })); } return(View(task)); }
public async Task <IActionResult> Create([Bind("StartDate,EstimatedEndDate,ID,Name,Description,ProjectID")] PSTS6.Models.Task task) { if (ModelState.IsValid) { string selectedProject = Request.Form["Project"].ToString(); task.ProjectID = Convert.ToInt32(selectedProject); await _repo.AddTask(task); return(RedirectToAction("Edit", "Projects", new { id = task.ProjectID })); } return(View(task)); }