public bool Delete(CommissionRatioEntity entity)
 {
     try
     {
         _commissionRatioRepository.Delete(entity);
         return true;
     }
     catch (Exception e)
     {
         _log.Error(e,"数据库操作出错");
         return false;
     }
 }
 public CommissionRatioEntity Update(CommissionRatioEntity entity)
 {
     try
     {
         _commissionRatioRepository.Update(entity);
         return entity;
     }
     catch (Exception e)
     {
         _log.Error(e,"数据库操作出错");
         return null;
     }
 }
 public HttpResponseMessage CreateOrUpdate(Models.Trading.CommissionRatio.CommissionRatio model)
 {
     if (model.Id>0)
     {
         var oldModel = _commissionRatioService.GetById(model.Id);
         oldModel.RecAgentScale = model.RecAgentScale;
         oldModel.RecCfbScale = model.RecCfbScale;
         oldModel.TakeAgentScale = model.TakeAgentScale;
         oldModel.TakeCfbScale = model.TakeCfbScale;
         oldModel.RecPartnerScale = model.RecPartnerScale;
         oldModel.TakePartnerScale = model.TakePartnerScale;
         if (_commissionRatioService.Update(oldModel) != null)
         {
             return PageHelper.toJson(PageHelper.ReturnValue(true, "数据更新成功"));
         }
         return PageHelper.toJson(PageHelper.ReturnValue(false, "数据更新失败"));
     }
     else
     {
        var newModel=new CommissionRatioEntity
        {
            RecCfbScale = model.RecCfbScale,
            RecAgentScale = model.RecAgentScale,
            TakeCfbScale = model.TakeCfbScale,
            TakeAgentScale= model.TakeAgentScale,
            TakePartnerScale =model.TakePartnerScale,
            RecPartnerScale = model.RecPartnerScale
        };
         if (_commissionRatioService.Create(newModel) != null)
         {
             return PageHelper.toJson(PageHelper.ReturnValue(true, "数据添加成功"));
         }
         return PageHelper.toJson(PageHelper.ReturnValue(false, "数据添加失败"));
     }
 }