public IActionResult DeleteConfirmed(int id)
        {
            var comment = commentManager.GetById((int)id);

            commentManager.Remove(comment);
            return(RedirectToAction("Index", "Posts"));
        }
 public IActionResult Delete(int id, IFormCollection form)
 {
     try
     {
         //obtenemos comentario
         var com = commentManager.GetById(id);
         if (com != null)
         {
             //eliminamos el comentario y guardamos
             commentManager.Remove(com);
             commentManager.Context.SaveChanges();
         }
         TempData["borrado"] = "El comentario se ha borrado correctamente";
         _log.LogInformation("Comentario eliminado correctamente: Id " + id.ToString());
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         _log.LogError(ex.Message, ex);
         return(View());
     }
 }