public async Task <IActionResult> Edit(int id, [Bind("PkWkspChatId,FkWkspChatWorkspace,FkWkspChatUser,WkspChatMessage,WkspChatTimeSent,WkspChatSender,WkspChatStatus,WkspChatTimeRead")] TblChatWorkspace tblChatWorkspace) { if (id != tblChatWorkspace.PkWkspChatId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tblChatWorkspace); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TblChatWorkspaceExists(tblChatWorkspace.PkWkspChatId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["FkWkspChatUser"] = new SelectList(_context.Users, "Id", "Id", tblChatWorkspace.FkWkspChatUser); ViewData["FkWkspChatWorkspace"] = new SelectList(_context.TblWorkspace, "PkWkspcId", "WkspcAmountAgreed", tblChatWorkspace.FkWkspChatWorkspace); return(View(tblChatWorkspace)); }
public async Task <IActionResult> Create([Bind("PkWkspChatId,FkWkspChatWorkspace,FkWkspChatUser,WkspChatMessage,WkspChatTimeSent,WkspChatSender,WkspChatStatus,WkspChatTimeRead")] TblChatWorkspace tblChatWorkspace) { if (ModelState.IsValid) { _context.Add(tblChatWorkspace); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FkWkspChatUser"] = new SelectList(_context.Users, "Id", "Id", tblChatWorkspace.FkWkspChatUser); ViewData["FkWkspChatWorkspace"] = new SelectList(_context.TblWorkspace, "PkWkspcId", "WkspcAmountAgreed", tblChatWorkspace.FkWkspChatWorkspace); return(View(tblChatWorkspace)); }