如何将子动作(渲染部分)调用到_layout? MVC不支持部分视图的异步?
public async Task<PartialViewResult> _Notification()
{
var data = new List<UserNotification>();
string apiNotificationUrl = APIProvider.APIGenerator("UserNotification", new List<string> { "UID" }, true, _userSession.UID);
try
{
//data = await Task.Run(() => APIProvider.Authorize_Get<List<UserNotification>>(_userSession.Token, apiNotificationUrl));
data = await APIProvider.Authorize_Get<List<UserNotification>>(_userSession.Token, apiNotificationUrl);
if (data == null) new List<UserNotification>();
}
catch (Exception ex)
{
throw;
}
return PartialView(data);
}
查看
@Html.Action("_Notification", "Home")