/// <summary> /// 保存实体数据(新增、修改) /// </summary> /// <param name="keyValue">主键</param> /// <param name="entity">实体</param> public void SaveEntity(string keyValue, ImgEntity entity) { try { if (!string.IsNullOrEmpty(keyValue)) { entity.Modify(keyValue); this.BaseRepository().Update(entity); } else { entity.Create(); this.BaseRepository().Insert(entity); } } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }
/// <summary> /// 获取图片 /// </summary> /// <param name="keyValue">主键</param> public void GetImg(string keyValue) { ImgEntity imgEntity = GetEntity(keyValue); if (imgEntity != null && !string.IsNullOrEmpty(imgEntity.F_Content)) { FileDownHelper.DownLoadBase64(imgEntity.F_Content.Replace("data:image/png;base64,", ""), imgEntity.F_Name); } }
/// <summary> /// 保存实体数据(新增、修改) /// </summary> /// <param name="keyValue">主键</param> /// <param name="entity">实体</param> public void SaveEntity(string keyValue, ImgEntity entity) { try { imgService.SaveEntity(keyValue, entity); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } }