我在Asp.net Core中有两个局部视图
@{ Html.RenderPartial("_List");}
@{ Html.RenderPartial("_Block");}
我的填充部分视图的方法
public async Task<IActionResult> Index(int pageNumber = 1, int pageSize = 10, SortType sortOrder = SortType.TitleAsc)
{
IQueryable<Advertisement> advertisements =
_context.Advertisements.Include(x => x.Country).Include(x => x.City);
var count = await advertisements.CountAsync();
var items = await advertisements.Skip((pageNumber - 1) * pageSize).Take(pageSize).ToListAsync();
IndexViewModel viewModel = new IndexViewModel
{
PageViewModel = new PageViewModel(count, pageNumber, pageSize),
SortViewModel = new SortViewModel(sortOrder),
Advertisements = items
};
return View(viewModel);
}
问题:如何使显示切换到不同的“部分视图”并将选择保存到cookie?