public async Task <IActionResult> Edit(int id, [Bind("Id,Title,CreatTime,ModifyTime,OP")] PTHThread pTHThread)
        {
            if (id != pTHThread.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pTHThread);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PTHThreadExists(pTHThread.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pTHThread));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Subject,OP,PostTime,PostFileName,PTHThreadId")] PTHPost pTHPost)
        {
            if (id != pTHPost.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pTHPost);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PTHPostExists(pTHPost.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index), new { ThreadId = pTHPost.PTHThreadId }));
            }
            ViewData["PTHThreadId"] = new SelectList(_context.PTHThreads, "Id", "Id", pTHPost.PTHThreadId);
            return(View(pTHPost));
        }