public ActionResult Index() { var viewModel = new CurrencyViewModel() { Currencies = CurrencyService.GetCurrencies() }; return View(viewModel); }
public ActionResult Index(CurrencyViewModel viewModel) { var context = GlobalHost.ConnectionManager.GetHubContext<CurrencyHub>(); viewModel.Currencies.ForEach(c => context.Clients.All.updateCurrency(c.Code, c.Price)); return View(viewModel); }