public async Task <IActionResult> EditAgendaPost(int id, [Bind("Id,ApplicationUserId,DateAndTime,Description")] AgendaPost agendaPost) { if (id != agendaPost.Id) { return(NotFound()); } if (ModelState.IsValid) { try { var nBSContext = _context.AgendaPost .Include(t => t.Creator); _context.Update(agendaPost); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AgendaPostExists(agendaPost.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(IndexSearchAgendaPosts))); } ViewData["ApplicationUserId"] = new SelectList(_context.Users, "Id", "UserName", agendaPost.ApplicationUserId); return(View(agendaPost)); }
public async Task <IActionResult> CreateAgendaPost([Bind("Id,ApplicationUserId,DateAndTime,Description")] AgendaPost agendaPost) { if (ModelState.IsValid) { var nBSContext = _context.AgendaPost .Include(t => t.Creator); _context.Add(agendaPost); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(IndexSearchAgendaPosts))); } ViewData["ApplicationUserId"] = new SelectList(_context.Users, "Id", "UserName", agendaPost.ApplicationUserId); return(View(agendaPost)); }