public async Task <IActionResult> Edit(Guid id, [Bind("Id,ApplicationUserId,EmailContentId")] SentEmailRecords sentEmailRecords) { if (id != sentEmailRecords.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(sentEmailRecords); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SentEmailRecordsExists(sentEmailRecords.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", sentEmailRecords.ApplicationUserId); return(View(sentEmailRecords)); }
public async Task <IActionResult> Create([Bind("Id,ApplicationUserId,EmailContentId")] SentEmailRecords sentEmailRecords) { if (ModelState.IsValid) { sentEmailRecords.Id = Guid.NewGuid(); _context.Add(sentEmailRecords); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", sentEmailRecords.ApplicationUserId); return(View(sentEmailRecords)); }