Is it possible to await on tasks in Razor .cshtml views?
await
By default it complains that it can only be used in methods marked with async so I
async
If you really need it, you can do this, it will be ugly, but it will work.
In View
@{ var foo = ViewBag.foo; var bar = ViewBag.bar; }
In Controller
public async Task Index() { ViewBag.foo = await _some.getFoo(); ViewBag.bar = await _some.getBar(); return View("Index"); }