public ActionResult SaveComment(int NodeId, string Comment) { TreeViewNodeVM model = null; string returnvalue = service.SaveComments(NodeId, Comment, sUser.UserId, sUser.UserType); if (returnvalue == "1") { List <CategoryCommentDetailUsers> objCategory = new List <CategoryCommentDetailUsers>(); objCategory = service.GetCategoryCommentDetailUsers(NodeId, sUser.UserId); if (objCategory.Count > 0) { var mail = UserMailer.NewCommentNotification(sUser.UserName.ToUpper(), objCategory.Select(x => x.ChannelNo).Distinct().FirstOrDefault(), objCategory.Select(x => x.ContentName).Distinct().FirstOrDefault()); mail.Subject = "New Comment from DeliverLoad"; foreach (var item in objCategory.Select(x => x.UserEmail).Distinct()) { mail.Bcc.Add(new MailAddress(item)); } var client = new SmtpClientWrapper(); mail.SendAsync("async send", client); } model = service.GetCategoryDescription(sUser.UserId, NodeId); } return(View("_ContentComment", model)); }
public TreeViewNodeVM GetCategoryDescription(int UserId, int NodeId) { TreeViewNodeVM Details = (from C in dbContext.CategoryContents where C.Id == NodeId select new TreeViewNodeVM { NodeId = C.Id, ContentDescription = C.Description, ImageName = C.ImageName, VideoName = C.VideoName, VideoFrom = C.VideoFrom, Name = C.Name }).First(); Details.ContentCommentModel = getCommentList(UserId, NodeId); return(Details); }
private void BuildChildNode(TreeViewNodeVM rootNode, int CategoryId) { if (rootNode != null) { List <TreeViewNodeVM> chidNode = (from C in dbContext.CategoryContents where C.ParentId == rootNode.NodeId && C.CategoryId == CategoryId select new TreeViewNodeVM() { NodeId = C.Id, Name = C.Name }).ToList <TreeViewNodeVM>(); if (chidNode.Count > 0) { foreach (var childRootNode in chidNode) { BuildChildNode(childRootNode, CategoryId); rootNode.ChildNode.Add(childRootNode); } } } }