Пример #1
0
        public Guid AddExchangeRate(AddExchangeRateCommand command)
        {
            var exchangeRate = new ExchangeRate()
            {
                ExchangeRateId = Guid.NewGuid(),
                Price          = command.Price,
                Name           = command.Name
            };

            _exchangeRateService.Insert(exchangeRate);
            _unitOfWork.SaveChanges();
            return(exchangeRate.ExchangeRateId);
        }
Пример #2
0
 private void Save(ExchangeRateModel model)
 {
     if (model.ExchangeRateId == Guid.Empty)
     {
         var createCommand = new AddExchangeRateCommand(model.Name, model.Price);
         model.ExchangeRateId = _exchangeRateCommandService.AddExchangeRate(createCommand);
     }
     else
     {
         var updateCommand = new EditExchangeRateCommand(model.ExchangeRateId, model.Name, model.Price);
         _exchangeRateCommandService.EditExchangeRate(updateCommand);
     }
 }