public Result Update(RechargeDto dto) { try { var entity = dto.MapTo <RechargeEntity>(); var rlt = UnitOfWorkService.Execute(() => _repo.Update(entity)); if (!rlt) { return new Result { Status = false, Message = "数据库操作失败" } } ; return(new Result { Status = true }); } catch (Exception ex) { Logger.Error("update Recharge error", ex); return(new Result { Status = false, Message = "内部服务器错误" }); } }
public Result Add(RechargeDto dto, UserType roleId) { try { var entity = dto.MapTo <RechargeEntity>(); var rlt = UnitOfWorkService.Execute(() => { var id = _repo.InsertAndGetId(entity); var orgId = _staffRepository.GetOrgId(dto.SalesMan).OrgId; var dataInOrg = new DataInOrgEntity { DataId = id.ToString(), DataType = (int)DataType.Recharge, OrgId = orgId, RoleId = ((int)roleId).ToString() }; var dataRlt = _dataInOrgRepository.Inserts(dataInOrg); if (id <= 0 && !dataRlt) { return(new Result { Status = false, Message = "数据库操作失败" }); } return(new Result { Status = true }); }); return(rlt); } catch (Exception ex) { Logger.Error("add Recharge error", ex); return(new Result { Status = false, Message = "内部服务器错误" }); } }