コード例 #1
0
        public void Execute(UpdateLotInstrumentPriceCommand command)
        {
            if (command == null)
            {
                throw new ArgumentNullException(nameof(command));
            }

            var lot = _lotRepository.GetById(command.LotId);

            if (lot == null)
            {
                throw new InvalidOperationException($"Cannot find lot with id `{command.LotId}`.");
            }

            var instrument = _instrumentRepository.GetById(lot.InstrumentInfo.Symbol);

            if (instrument == null)
            {
                throw new InvalidOperationException($"Cannot find instrument with symbol `{lot.InstrumentInfo.Symbol}`.");
            }

            lot.UpdateInstrumentPrice(instrument.CurrentPrice);

            _lotRepository.Update(lot);
        }
コード例 #2
0
 public LotEntity GetLotEntity(int id)
 {
     try
     {
         return(_lotRepository.GetById(id).ToLotEntity());
     }
     catch (Exception exception)
     {
         Log.LogError(exception);
         return(null);
     }
 }
コード例 #3
0
 public LotDto GetItem(int id)
 {
     return(_lotRepository.GetById(id)?.ToDto());
 }
コード例 #4
0
        public void When(LotWasCreatedDomainEvent domainEvent)
        {
            var createdLot = _lotRepository.GetById(domainEvent.LotId);

            StartTrackingInstrumentForLot(createdLot);
        }
コード例 #5
0
 public Lot GetLot(int id)
 {
     return(lotRepository.GetById(id));
 }
コード例 #6
0
 public LotEntity GetLotEntity(int id)
 {
     return(_lotRepository.GetById(id)?.ToBllLotEntity());
 }