public async Task <ActionResult <ResponsetoComment> > PostResponsetoComment(ResponsetoComment responsetoComment) { _context.ResponsetoComment.Add(responsetoComment); await _context.SaveChangesAsync(); return(CreatedAtAction("GetResponsetoComment", new { id = responsetoComment.id }, responsetoComment)); }
public async Task <IActionResult> Edit(int id, [Bind("id,idofcomment,Containt,time")] ResponsetoComment responsetoComment) { if (id != responsetoComment.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(responsetoComment); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ResponsetoCommentExists(responsetoComment.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(responsetoComment)); }
public async Task <IActionResult> PutResponsetoComment(int id, ResponsetoComment responsetoComment) { if (id != responsetoComment.id) { return(BadRequest()); } _context.Entry(responsetoComment).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ResponsetoCommentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("id,idofcomment,idofstudent,Containt,time")] ResponsetoComment responsetoComment) { if (ModelState.IsValid) { responsetoComment.idof = Guid.NewGuid().ToString(); _context.Add(responsetoComment); await _context.SaveChangesAsync(); return(Redirect("http://localhost:4200/HomePage/" + responsetoComment.idofstudent)); } return(View(responsetoComment)); }