public RedirectToActionResult Details(BugCommentsViewModel bugCommentsViewModel) { var userid = userManager.GetUserId(User); BugComment bugComment = new BugComment { BugId = bugCommentsViewModel.bug.BugId, Comment = bugCommentsViewModel.bugComment.Comment, CommentDate = DateTime.Now, ApplicationUserId = userid, }; _bugCommentRepository.AddBugComment(bugComment); return(RedirectToAction()); }
public ViewResult Details(int id) { BugCommentsViewModel bugCommentsViewModel = new BugCommentsViewModel(); IEnumerable <Bug> bugs = _bugRepository.GetBugWithComments(id); bugCommentsViewModel.bug = bugs.ToList()[0]; IEnumerable <BugComment> bugComments = bugs.ToList()[0].BugComments; List <BugComment> bugCommentsWithUser = new List <BugComment>(); foreach (var bugComment in bugComments) { bugCommentsWithUser.Add(_bugCommentRepository.GetBugComment(bugComment.BugCommentId).ToList()[0]); } bugCommentsViewModel.bugComments = bugCommentsWithUser; return(View(bugCommentsViewModel)); }
public ViewResult Details(int id) { BugCommentsViewModel bugCommentsViewModel = new BugCommentsViewModel(); IEnumerable <Bug> bugs = _bugRepository.GetBugWithComments(id); bugCommentsViewModel.bug = bugs.ToList()[0]; IEnumerable <BugComment> bugComments = bugs.ToList()[0].BugComments; List <BugComment> bugCommentsWithUser = new List <BugComment>(); int i = 0; foreach (var bugComment in bugComments) { var formatedBug = _bugCommentRepository.GetBugComment(bugComment.BugCommentId).ToList()[0]; formatedBug.Comment = WebUtility.HtmlDecode(formatedBug.Comment); bugCommentsWithUser.Add(formatedBug); } bugCommentsViewModel.bugComments = bugCommentsWithUser; return(View(bugCommentsViewModel)); }