public HttpResponseMessage UpOrderStatus(int id)
        {
            var entity = _orderService.GetOrderById(id);
            if (entity == null)
            {
                return null;
            }
            var model = new OrderModel
            {
             
                Details = entity.Details.Select(c => new OrderDetailModel
                {
                  
                    Status = c.Status == 0 ? "未评价" : "已评价"
                }).ToList()
            };
            string sta="已评价";
            foreach (var item in model.Details)
            {
                if(item.Status =="未评价")
                {
                    sta = "未评价";
                }
            }
            if(sta=="已评价")
            {
                var entity1 = _orderService.GetOrderById(id);
                if (entity1 == null)
                    return PageHelper.toJson(PageHelper.ReturnValue(false, string.Format("无法获取到Id为{0}的订单", id)));
                //if (_workContext.CurrentUser.Id != entity.AddUser &&
                //    !((UserBase)_workContext.CurrentUser).UserRoles.Select(c => c.Role.RoleName)
                //        .ToList()
                //        .Intersect(allowEditRoles)
                //        .Any())
                //    return PageHelper.toJson(PageHelper.ReturnValue(false, "当前用户没有权限修改此订单"));
               
                entity1.Status = EnumOrderStatus .Canceled ;
                //entity.UpdUser = _workContext.CurrentUser.Id;
                entity1.UpdDate = DateTime.Now;
                return PageHelper.toJson(_orderService.Update(entity1) != null ? PageHelper.ReturnValue(true, "该订单全部商品已评价完毕") : PageHelper.ReturnValue(false, "操作失败,请查看日志"));
            }

            return PageHelper.toJson(new { List = model });
        }
        public HttpResponseMessage Get(int id)
        {
            var currentUser = (UserBase)_workContext.CurrentUser;


            var entity = _orderService.GetOrderById(id);
            if (
                !currentUser.UserRoles.ToList()
                    .Exists(c => c.Role.RoleName == "superAdmin" || c.Role.RoleName == "admin") &&
                entity.AddUser != currentUser.Id)
                return null;
            if (entity == null)
            {
                return null;
            }
            var model = new OrderModel
            {
                Id = entity.Id,
                No = entity.No,
                Status = entity.Status,
                CustomerName = entity.CustomerName,
                Remark = entity.Remark,
                Adddate = entity.AddDate,
                Adduser = entity.AddUser,
                Upduser = entity.UpdUser,
                Upddate = entity.UpdDate,
                Totalprice = entity.Totalprice,
                Actualprice = entity.Actualprice,
                Details = entity.Details.Select(c => new OrderDetailModel
                {
                    Count = c.Count,
                    Id = c.Id,
                    Product = new ProductModel
                    {
                        Id = c.Product.Id,
                        MainImg = c.Product.MainImg,
                        Name = c.Product.Name,
                        Price = c.Product.Price,
                        OldPrice = c.Product.OldPrice
                    },
                    ProductName = c.ProductName,
                    UnitPrice = c.UnitPrice,
                    Remark = c.Remark,
                    Snapshoturl = c.Snapshoturl,
                    Totalprice = c.Totalprice,
                    Status =c.Status ==0?"未评价":"已评价"
                }).ToList(),
                UserName = entity.AddMember.UserName
            };

            return PageHelper.toJson(new { List = model });
		}