public async Task Handle(AddTradeEvaluationCommand notification) { var entityCurrentNotification = Mapper.Map <TradeEvaluationModel, Evaluation>(notification.TradeEvaluationModel); if (!IsEntityValid(entityCurrentNotification)) { return; } var entityCurrentDB = await _tradeRepository.GetByIdAsync(notification.TradeEvaluationModel.IdParent); if (!IsEntityFound(entityCurrentDB, notification.MessageType, "Trade.NotFound")) { return; } var userEntity = GetUserEntityTrade(notification.UserLoggedIn, entityCurrentDB.UserGet, entityCurrentDB.UserLet); if (userEntity == null) { return; } if (!IsUserCanModifyEntity(notification.UserLoggedIn, userEntity)) { return; } await _tradeRepository.AddEvaluationAsync(entityCurrentDB.Id, entityCurrentNotification); if (Commit()) { await _mediator.PublishEvent(new TradeEvaluationAddedEvent(_logger, Mapper.Map <TradeEvaluationModel>(notification.TradeEvaluationModel))); } }
public Task <Trade> GetByIdAsync(string brokerId, long id) { return(_tradeRepository.GetByIdAsync(brokerId, id)); }
public async Task <Trade> GetByIdAsync(string id) { var result = await _repo.GetByIdAsync(id); return(result); }
public Task <Trade> GetTradeByIdAsync(string tradeId) { return(_tradeRepository.GetByIdAsync(tradeId)); }