/// <summary> /// Münze einwerfen. /// Wurde zumindest der Produktpreis eingeworfen, Münzen in Depot übernehmen /// und für Order Retourgeld festlegen. Bestellug abschließen. /// </summary> /// <returns>true, wenn die Bestellung abgeschlossen ist</returns> public bool InsertCoin(Order order, int coinValue) { bool isPrice = order .InsertCoin(coinValue); if (isPrice) { order.FinishPayment(_coinRepository.GetAll()); } _dbContext.SaveChanges(); return(isPrice); }
public IActionResult GetAll() { var coins = _coinRepository.GetAll(); var coinDtos = _mapper.Map <IList <CoinDto> >(coins); return(Ok(coinDtos)); }
public MainWindowViewModel(ICoinRepository coinRepository, IUnitOfWorkFactory unitOfWorkFactory, ICoinModelFactory coinModelFactory, IDirtySerializableCacheService serializableCacheService) { _coinModelFactory = coinModelFactory; _serializableCacheService = serializableCacheService; RemoveCoinCommand = new RelayCommand <WindowCommandContext>(RemoveCoin, CanRemoveCoin); ShowEditCoinControlCommand = new RelayCommand(ShowEditCoinControl, CanShowEditCoinControl); ShowAddCoinControlCommand = new RelayCommand(ShowAddCoinControl); SaveAllCommand = new RelayCommand <WindowCommandContext>(SaveAll, CanSaveAll); AddNewCoinCommand = new RelayCommand <WindowCommandContext>(AddNewCoin); ToggleGroupingPanelCommand = new RelayCommand(ToggleGroupingPanel); _serializableCacheService.CacheChanged += CacheChangedHandler; using (unitOfWorkFactory.Create()) { Coins.AddRange(coinRepository.GetAll().Select(x => _coinModelFactory.Create(x))); } CoinsCollectionView = CollectionViewSource.GetDefaultView(Coins); CoinsCollectionView.CurrentChanged += CoinsCollectionChangedHandler; }
public async Task <CommandResult <CoinDtos> > Handle(GetCoinsCommand request, CancellationToken cancellationToken) { try { var coins = await _coinRepository.GetAll(); var coinDtos = _mapper.Map <CoinDtos>(coins); return(new CommandResult <CoinDtos>(coinDtos)); } catch (Exception e) { var failureReason = Resource.FailedToRetrieveCoins; _logger.LogError(e, failureReason); return(new CommandResult <CoinDtos>(failureReason)); } }
public Task <IEnumerable <ICoin> > GetAll() { return(_coinRepository.GetAll()); }