public async Task <IActionResult> Edit(int id, [Bind("NewspaperCommentID,UserID,NewspaperID,Comment,CommentDate,CommentEnabled")] NewspaperComment newspaperComment)
        {
            if (id != newspaperComment.NewspaperCommentID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(newspaperComment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NewspaperCommentExists(newspaperComment.NewspaperCommentID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserID"]      = new SelectList(_context.ApplicationUsers, "Id", "FirstName", newspaperComment.UserID);
            ViewData["NewspaperID"] = new SelectList(_context.Newspapers, "NewspaperID", "CurrentPeriodicity", newspaperComment.NewspaperID);
            return(View(newspaperComment));
        }
        public async Task <IActionResult> DisabledComment(int id)
        {
            NewspaperComment newspaperComment = _context.NewspaperComments.Where(m => m.NewspaperCommentID == id).First();

            newspaperComment.CommentEnabled = false;
            _context.Update(newspaperComment);
            await _context.SaveChangesAsync();

            return(RedirectToAction("Details", "Newspapers", new { id = newspaperComment.NewspaperID }));
        }
        public async Task <IActionResult> Create(string Comment, [Bind("NewspaperCommentID,UserID,NewspaperID,Comment,CommentDate,CommentEnabled")] NewspaperComment newspaperComment)
        {
            var userId = int.Parse(_userManager.GetUserId(HttpContext.User));

            newspaperComment.UserID         = userId;
            newspaperComment.CommentDate    = DateTime.Now;
            newspaperComment.CommentEnabled = true;
            newspaperComment.Comment        = Comment;
            _context.Add(newspaperComment);
            await _context.SaveChangesAsync();

            return(RedirectToAction("Details", "Newspapers", new { id = newspaperComment.NewspaperID }));
        }