//订单评论 public object PostAddComment(CommentAddCommentModel value) { CheckUserLogin(); try { string Jsonstr = value.Jsonstr; bool result = false; var orderComment = Newtonsoft.Json.JsonConvert.DeserializeObject <OrderCommentModel>(Jsonstr); if (orderComment != null) { using (TransactionScope scope = new TransactionScope()) { AddOrderComment(orderComment); //添加订单评价 AddProductsComment(orderComment.OrderId, orderComment.ProductComments); //添加商品评论 scope.Complete(); } result = true; } return(Json(new { success = result })); } catch (Exception ex) { return(Json(new { success = false })); } }
public object PostAddComment(CommentAddCommentModel value) { CheckUserLogin(); string Jsonstr = value.Jsonstr; bool result = false; var orderComment = Newtonsoft.Json.JsonConvert.DeserializeObject <OrderCommentModel>(Jsonstr); if (orderComment != null) { AddOrderComment(orderComment); //添加订单评价 AddProductsComment(orderComment.OrderId, orderComment.ProductComments); //添加商品评论 result = true; } return(new { success = result }); }
//发布评论 public JsonResult <Result <int> > PostAddComment(CommentAddCommentModel value) { CheckUserLogin(); try { string Jsonstr = value.Jsonstr; bool result = false; var orderComment = Newtonsoft.Json.JsonConvert.DeserializeObject <OrderCommentModel>(Jsonstr); if (orderComment != null) { AddOrderComment(orderComment, orderComment.ProductComments.Count()); //添加订单评价 AddProductsComment(orderComment.OrderId, orderComment.ProductComments); //添加商品评论 result = true; } return(Json(ApiResult <int>(result))); } catch (Exception ex) { Core.Log.Error(ex); return(Json(ErrorResult <int>(ex.Message))); } }