public IActionResult Buy(int id) { var productModel = _productStore.FindById(id); var viewModel = new OrderViewModel { Product = new ProductViewModel(productModel), Payment = (productModel.CostType == ECostType.Dollar ? (PaymentViewModelBase) new PaymentByCreditCardViewModel() : (PaymentViewModelBase) new PaymentByGoldViewModel()) }; return(View(viewModel)); }