public async Task <IActionResult> Edit(int id, [Bind("Id", "Participant1Id", "Participant2Id", "Timestamp")] ConversationViewModel viewModel) { if (id != viewModel.Id) { return(NotFound()); } if (ModelState.IsValid) { try { var conversation = viewModel.ToConversation(_context); _context.Update(conversation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ConversationExists(viewModel.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(viewModel)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Tag,IsPresent")] Participant participant) { if (id != participant.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(participant); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ParticipantExists(participant.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(participant)); }