예제 #1
0
        public ActionResult Delete(long notificationId, long commentId)
        {
            var comments = _notificationCommentRepository.GetById(commentId);

            _notificationCommentRepository.Delete(comments);
            return(RedirectToAction("Index", new { notificationId }));
        }
        public ActionResult Delete(long notificationId, long commentId)
        {
            var comments = _notificationCommentRepository.GetById(commentId);

            _notificationCommentRepository.Delete(comments);

            var notification = _notificationRepository.GetById(notificationId);

            var commentsForNotifications = notification.NotificationComments.Select(comment => new NotificationCommentsModel()
            {
                NotificationId = notificationId,
                CommentId      = comment.Id,
                Comment        = comment.CommentText,
                CreationDate   = comment.CreationDate,
                Username       = comment.Parent.FullName
            }).ToList();

            return(View("Index", commentsForNotifications));
        }