コード例 #1
0
 public HttpResponseMessage AddMerchantInfo(MerchantInfoModel merchantInfoModel)
 {
     if (string.IsNullOrEmpty(merchantInfoModel.Merchantname) && string.IsNullOrEmpty(merchantInfoModel.Mail))
     {
         if (!PageHelper.IsEmail(merchantInfoModel.Mail))
         {
             return(PageHelper.toJson(PageHelper.ReturnValue(false, "Email格式验证错误!")));
         }
         var merchantInfoEntity = new MerchantInfoEntity()
         {
             Merchantname = merchantInfoModel.Merchantname,
             Mail         = merchantInfoModel.Mail
         };
         try
         {
             if (_merchantInfoService.Create(merchantInfoEntity) != null)
             {
                 return(PageHelper.toJson(PageHelper.ReturnValue(true, "数据添加成功!")));
             }
         }
         catch
         {
             return(PageHelper.toJson(PageHelper.ReturnValue(false, "数据添加失败!")));
         }
     }
     return(PageHelper.toJson(PageHelper.ReturnValue(false, "数据验证错误!")));
 }
コード例 #2
0
 public MerchantInfoEntity Update(MerchantInfoEntity entity)
 {
     try
     {
         _merchantinfoRepository.Update(entity);
         return(entity);
     }
     catch (Exception e)
     {
         _log.Error(e, "数据库操作出错");
         return(null);
     }
 }
コード例 #3
0
 public bool Delete(MerchantInfoEntity entity)
 {
     try
     {
         _merchantinfoRepository.Delete(entity);
         return(true);
     }
     catch (Exception e)
     {
         _log.Error(e, "数据库操作出错");
         return(false);
     }
 }