@model List @{ ViewData["Title"] = "工具列表"; var categories = ViewBag.Categories as List ?? new List(); var currentCategory = ViewBag.CurrentCategory as int? ?? 0; var search = ViewBag.Search as string; }

@if (!string.IsNullOrEmpty(search)) { 搜索结果: "@search" } else if (currentCategory > 0) { var categoryName = categories.FirstOrDefault(c => c.Id == currentCategory)?.Name ?? "工具"; @categoryName } else { 所有工具 }

发现更多实用工具,提升您的工作效率

@if (string.IsNullOrEmpty(search)) {
全部工具 @foreach (var category in categories) { @category.Name }
} @if (Model.Any()) {
@foreach (var tool in Model) {
@if (!string.IsNullOrEmpty(tool.Image)) { @tool.Name } else {
} @if (tool.IsHot) {
热门
} @if (tool.IsNew) {
新品
} @if (tool.IsRecommended) { }

@tool.Name

@(tool.Description ?? "")

}
} else {

@if (!string.IsNullOrEmpty(search)) { 未找到相关工具 } else { 暂无工具 }

@if (!string.IsNullOrEmpty(search)) { 试试其他关键词,或浏览其他分类的工具 } else { 该分类下暂时没有工具,敬请期待 }

浏览所有工具
}