public async Task <IActionResult> Edit(int id, [Bind("Id,ReleaseDate,Comment,NickName,Reputation")] CommentariesModel commentariesModel) { if (id != commentariesModel.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(commentariesModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CommentariesModelExists(commentariesModel.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(commentariesModel)); }
public async Task <IActionResult> Create([Bind("Id,ReleaseDate,Comment,NickName,Reputation")] CommentariesModel commentariesModel) { if (ModelState.IsValid) { _context.Add(commentariesModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Comments))); } return(View(commentariesModel)); }