コード例 #1
0
 public void EditExchangeRate(EditExchangeRateCommand command)
 {
   var exchangeRate = _exchangeRateService.Find(command.ExchangeRateId);
   exchangeRate.Name = command.Name;
   exchangeRate.Price = command.Price;
   _exchangeRateService.Update(exchangeRate);
   _unitOfWork.SaveChanges();
 }
コード例 #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);
   }
 }