public async Task <IActionResult> Edit(int id, [Bind("ProjectID,PersonID,BeginTime,FinishTime")] ProjectPartakePerson projectPartakePerson) { if (id != projectPartakePerson.ProjectID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(projectPartakePerson); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProjectPartakePersonExists(projectPartakePerson.ProjectID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index/" + id)); } ViewData["PersonID"] = new SelectList(_context.Person, "Id", "Name", projectPartakePerson.PersonID); ViewData["ProjectID"] = new SelectList(_context.Project, "ID", "Name", projectPartakePerson.ProjectID); return(View(projectPartakePerson)); }
public async Task <IActionResult> Create([Bind("ProjectID,PersonID,BeginTime,FinishTime")] ProjectPartakePerson projectPartakePerson) { if (ModelState.IsValid) { _context.Add(projectPartakePerson); await _context.SaveChangesAsync(); return(RedirectToAction("Index", "Project")); } ViewData["PersonID"] = new SelectList(_context.Person, "Id", "Name", projectPartakePerson.PersonID); ViewData["ProjectID"] = new SelectList(_context.Project, "ID", "Name", projectPartakePerson.ProjectID); return(View(projectPartakePerson)); }