public IActionResult AddComment(NewsVM model) { Comment comment = new Comment(); User user = new User(); News news = _newscontext.News.FirstOrDefault(x => x.ID == model.ID); model.Title = news.Title; comment.NewsId = model.ID; comment.Content = model.Comment.Content; user = _newscontext.Users.Where(q => q.EMail == model.UserEmail).FirstOrDefault(); comment.UserId = user.ID; comment.ParentId = 0; _newscontext.Comments.Add(comment); _newscontext.SaveChanges(); string url = "/haber/" + model.ID + "/" + UrlHelpers.FriendlyUrl(model.Title); return(Redirect(url)); }