public List <VComment> GetChildren(List <VComment> comments, VComment current) { var children = comments.Where(x => x.ParentId == current.Id).ToList(); foreach (var c in children) { c.Children = GetChildren(comments, c); } return(children); }
public IActionResult PostComment(VComment c) { var comment = new DataLayer.Models.TComment { Id = Guid.NewGuid(), Comment = c.Comment, DatePosted = DateTime.Now, DomainId = "gpucheck", Ip = "11111111", Path = "/", Name = c.Name }; var posted = business.PostComment(comment); return(Json(posted)); }
public List <VComment> SelectCommentInfo(int pageSize, int pageIndex, int id) { var list = new List <VComment>(); DataSet ds = new DalComment().SelectCommentInfo(pageSize, pageIndex, id); DataTable dt = new DataTable(); if (ds != null && ds.Tables.Count > 0) { dt = ds.Tables[0]; } foreach (DataRow dr in dt.Rows) { VComment model = new VComment { CommentedContent = Convert.ToString(dr["CommentedContent"]), UserIP = Convert.ToString(dr["UserIP"]), CreatedTime = Convert.ToString(dr["CreatedTime"]) }; list.Add(model); } return(list); }
public async Task <IViewComponentResult> InvokeAsync(VComment c) { return(await Task.FromResult((IViewComponentResult)View("Default", c))); }