public List <BBSCommentVM> MakeCommentOrder(List <BBSCommentVM> source, List <BBSCommentVM> result, long parentId) { if (result == null) { result = new List <BBSCommentVM>(); } BBSCommentVM subComment = source.Where(s => s.BindTableID == parentId && s.BindTableName == "bbscomment").FirstOrDefault(); //if(subComment==null) //else return(null); }
public BBSCommentVM SaveComment(BBSCommentVM vm) { if (vm == null || string.IsNullOrEmpty(vm.BindTableName) || !vm.BindTableID.HasValue) { return(null); } using (var dbContext = new DbContext().ConnectionStringName(ConnectionUtil.connBBS, new MySqlProvider())) { vm.ID = dbContext.Insert("bbscomment").Column("BindTableID", vm.BindTableID) .Column("BindTableName", vm.BindTableName) .Column("UserID", vm.UserID) .Column("UserName", vm.UserName) .Column("InputTime", vm.InputTime) .Column("Content", vm.Content) .ExecuteReturnLastId <long>(); return(vm); } }
public ActionResult SaveComment(BBSCommentVM vm) { if (vm == null || string.IsNullOrEmpty(vm.BindTableName) || !vm.BindTableID.HasValue) { return(Json(new { Code = -400, Msg = "参数不能为空", Data = "" })); } vm.UserName = this.UserData.UserName; vm.UserID = this.UserData.UserID; vm.InputTime = DateTime.Now; vm = new BBSCommentService().SaveComment(vm); return(Json(new { Code = 200, Msg = "保存成功", Data = vm })); }