Esempio n. 1
0
        public void UpdateStockSplit(StockSplitViewModel stockSplitVm)
        {
            Guard.AgainstNull(() => stockSplitVm);

            var stockSplit = _viewModelToModelMapper.MapToStockSplit(stockSplitVm);
            _stockService.UpdateStockSplit(stockSplit);
        }
Esempio n. 2
0
        public void CreateStockSplit(StockSplitViewModel stockSplitVm)
        {
            Guard.AgainstNull(() => stockSplitVm);

            var stockSplit = _viewModelToModelMapper.MapToStockSplit(stockSplitVm);
            _stockService.CreateStockSplit(stockSplit);
            stockSplitVm.Id = stockSplit.Id;
        }
 public StockSplit MapToStockSplit(StockSplitViewModel stockSplitVm)
 {
     var stockSplit = GetStockSplit(stockSplitVm, false);
     return stockSplit;
 }
        private StockSplit GetStockSplit(StockSplitViewModel stockSplitVm, bool mapRelations)
        {
            if (stockSplitVm == null)
                return null;

            return new StockSplit(
                stockSplitVm.Id,
                stockSplitVm.Date.Value,
                stockSplitVm.OldStock.Id,
                stockSplitVm.NewStock.Id,
                stockSplitVm.RatioFrom,
                stockSplitVm.RatioTo,
                mapRelations ? GetStock(stockSplitVm.OldStock, false) : null,
                mapRelations ? GetStock(stockSplitVm.NewStock, false) : null);
        }
        private void SetModificationState(StockSplitViewModel vm, ModificationStates state)
        {
            if (SelectedStockSplit != null && ModificationState == ModificationStates.Edit)
                SelectedStockSplit.UndoChanges();

            ModificationState = state;
            SelectedStockSplit = vm;
            SelectedStockSplit.ReevaluateOnDirtyStateAndValidationChanges(SaveCommand);
        }
 private void BeginDelete(StockSplitViewModel stockSplit) => SetModificationState(stockSplit, ModificationStates.Delete);
 private void BeginEdit(StockSplitViewModel stockSplit) => SetModificationState(stockSplit, ModificationStates.Edit);