public async Task <ActionResult <PTHThread> > PostPTHThread(PTHThread pTHThread) { _context.PTHThreads.Add(pTHThread); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetPTHThread), new { id = pTHThread.Id }, pTHThread)); }
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)); }
public async Task <IActionResult> PutPTHThread(int id, PTHThread pTHThread) { if (id != pTHThread.Id) { return(BadRequest()); } _context.Entry(pTHThread).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PTHThreadExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("Id,Title,CreatTime,ModifyTime,OP,ThreadCategory,ToolOrTech")] PTHThread pTHThread) { if (ModelState.IsValid) { _context.Add(pTHThread); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index), controllerName: "PTHThreads", routeValues: new { ThreadCategory = pTHThread.ThreadCategory, ToolOrTech = pTHThread.ToolOrTech } )); } return(View(pTHThread)); }