public JsonResult AddOrderEvaluationAndComment(int packMark, int deliveryMark, int serviceMark, long orderId, string productCommentsJSON) { if (packMark != 0 || deliveryMark != 0 || serviceMark == 0) { var info = new DTO.OrderComment(); info.UserId = CurrentUser.Id; info.PackMark = packMark; info.DeliveryMark = deliveryMark; info.ServiceMark = serviceMark; info.OrderId = orderId; TradeCommentApplication.Add(info); } var productComments = JsonConvert.DeserializeObject <List <ProductCommentsModel> >(productCommentsJSON); var list = new List <DTO.ProductComment>(); foreach (var productComment in productComments) { var model = new ProductComment(); model.ReviewDate = DateTime.Now; model.ReviewContent = productComment.content; model.UserId = CurrentUser.Id; model.UserName = CurrentUser.UserName; model.Email = CurrentUser.Email; model.SubOrderId = productComment.subOrderId; model.ReviewMark = productComment.star; if (productComment.proimages != null && productComment.proimages.Length > 0) { model.Images = new List <ProductCommentImage>(); foreach (var img in productComment.proimages) { var p = new ProductCommentImage(); p.CommentType = 0; //0代表默认的表示评论的图片 p.CommentImage = MoveImages(img, CurrentUser.Id); model.Images.Add(p); } } list.Add(model); } var comments = CommentApplication.GetProductEvaluationByOrderIdNew(orderId, CurrentUser.Id); foreach (var item in comments) { var addComment = productComments.FirstOrDefault(e => e.subOrderId == item.Id); if (addComment != null) { return(Json(new Result() { success = false, msg = "您已进行过评价!", status = -1 })); } } CommentApplication.Add(list); return(Json(new Result() { success = true, msg = "评价成功" })); }
public JsonResult AddOrderEvaluation(DTO.OrderComment model) { model.UserId = CurrentUser.Id; TradeCommentApplication.Add(model); return(Json(new Result() { success = true, msg = "评价成功" })); }
void AddOrderComment(OrderCommentModel comment) { TradeCommentApplication.Add(new OrderComment() { OrderId = comment.OrderId, DeliveryMark = comment.DeliveryMark, ServiceMark = comment.ServiceMark, PackMark = comment.PackMark, UserId = CurrentUser.Id, }); }
void AddOrderComment(OrderCommentModel comment, int productNum) { TradeCommentApplication.Add(new DTO.OrderComment() { OrderId = comment.OrderId, DeliveryMark = comment.DeliveryMark, ServiceMark = comment.ServiceMark, PackMark = comment.PackMark, UserId = CurrentUser.Id }, productNum); }