public async Task <IActionResult> Edit(int id, [Bind("InterestWorkerID,InterestID,WorkerID")] InterestWorker interestWorker) { if (id != interestWorker.InterestWorkerID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(interestWorker); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InterestWorkerExists(interestWorker.InterestWorkerID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["InterestID"] = new SelectList(_context.Interest, "InterestID", "InterestID", interestWorker.InterestID); ViewData["WorkerID"] = new SelectList(_context.Worker, "ID", "ID", interestWorker.WorkerID); return(View(interestWorker)); }
public async Task <IActionResult> Create([Bind("InterestWorkerID,InterestID,WorkerID")] InterestWorker interestWorker) { if (ModelState.IsValid) { _context.Add(interestWorker); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["InterestID"] = new SelectList(_context.Interest, "InterestID", "InterestID", interestWorker.InterestID); ViewData["WorkerID"] = new SelectList(_context.Worker, "ID", "ID", interestWorker.WorkerID); return(View(interestWorker)); }