public async Task <IActionResult> Edit(int id, [Bind("Id,SenderId,ReceiverId,MessagingTypeId,MessageBody")] Message message) { if (id != message.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(message); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MessageExists(message.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["MessagingTypeId"] = new SelectList(_context.Set <MessagingType>(), "Id", "Id", message.MessagingTypeId); ViewData["ReceiverId"] = new SelectList(_context.Set <Receiver>(), "Id", "Id", message.ReceiverId); ViewData["SenderId"] = new SelectList(_context.Set <Sender>(), "Id", "Id", message.SenderId); return(View(message)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,SenderName,SenderEmail")] Sender sender) { if (id != sender.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(sender); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SenderExists(sender.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(sender)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,MethodName")] MessagingType messagingType) { if (id != messagingType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(messagingType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MessagingTypeExists(messagingType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(messagingType)); }