public ServiceOrderEntity Update (ServiceOrderEntity entity)
		{
			try
            {
                _serviceorderRepository.Update(entity);
                return entity;
            }
            catch (Exception e)
            {
				_log.Error(e,"数据库操作出错");
                return null;
            }
		}
		public bool Delete(ServiceOrderEntity entity)
		{
			try
            {
                _serviceorderRepository.Delete(entity);
                return true;
            }
            catch (Exception e)
            {
				_log.Error(e,"数据库操作出错");
                return false;
            }
		}
        public HttpResponseMessage Post([FromBody]ServiceOrderModel model)
        {
            //获取订单明细对应的商品
            var products = _productService.GetProductsByCondition(new ProductSearchCondition
            {
                Ids = model.Details.Select(c => c.Product.Id).ToArray(),
                Type = EnumProductType.Service
            }).ToList().Select(p => new ServiceOrderDetailEntity
            {
                Count = model.Details.First(d => d.Product.Id == p.Id).Count,
                Product = p,
                Price = p.Price
            }).ToList();
            if (products.Count < 1)
                return PageHelper.toJson(PageHelper.ReturnValue(false, "生成订单失败,无法找到服务商品"));
            //订单编号
            Random rd = new Random();
            var orderNumber = "S" + DateTime.Now.ToString("yyyyMMddHHmmssffff") + rd.Next(100, 999);

            //订单实体
            var entity = new ServiceOrderEntity
            {
                OrderNo = orderNumber,
                AddTime = DateTime.Now,
                AddUser = _workContext.CurrentUser.Id,
                Flee = products.Sum(c => (c.Count * c.Price)),
                Address = _memberAddressService.GetMemberAddressById(model.MemberAddressId),
                Servicetime = model.Servicetime,
                Remark = model.Remark,
                Details = products,
                Status = EnumServiceOrderStatus.Created,
                UpdUser = _workContext.CurrentUser.Id,
                UpdTime = DateTime.Now,
                AddMember = _memberService.GetMemberByUserId(_workContext.CurrentUser.Id)
            };

            //保存
            if (_serviceOrderService.Create(entity).Id > 0)
            {
                //TODO:回掉接口写到Msg里,完成回掉方法
                return PageHelper.toJson(PageHelper.ReturnValue(true, "null", new ServiceOrderModel()
                {
                    Id = entity.Id,
                    OrderNo = entity.OrderNo,
                    Flee = entity.Flee,
                    Addtime = entity.AddTime
                }));
            }
            return PageHelper.toJson(PageHelper.ReturnValue(false, "生成服务订单失败"));
        }