public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Hours,CurrentHours,TaskName,Submitter,SubmissionDate,ProjectID")] ProDLabour proDLabour) { if (id != proDLabour.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(proDLabour); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProDLabourExists(proDLabour.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ProjectID"] = new SelectList(_context.Projects, "ID", "Name", proDLabour.ProjectID); return(View(proDLabour)); }
public async Task <IActionResult> Create([Bind("ID,Name,Hours,CurrentHours,TaskName,Submitter,SubmissionDate,ProjectID")] ProDLabour proDLabour) { if (ModelState.IsValid) { _context.Add(proDLabour); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ProjectID"] = new SelectList(_context.Projects, "ID", "Name", proDLabour.ProjectID); return(View(proDLabour)); }