server/aspnetapp/Controllers/WebUI/GoodsController.cs
(开头部分) 34KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
#nullable disable
using aspnetapp.Helper;
using aspnetapp.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
using RestSharp;
using System.Collections.Specialized;
using System.Net;
using System.Text;
using System.Text.Json;
namespace aspnetapp.Controllers.WebUI
{
public class GoodsController : Controller
{
private readonly CounterContext _context;
private readonly IWebHostEnvironment _env;
private IMemoryCache _memoryCache;
public GoodsController(CounterContext context, IWebHostEnvironment e, IMemoryCache cache)
{
_context = context;
_env = e;
this._memoryCache = cache ?? throw new ArgumentNullException(nameof(cache));
}
// GET: SpecialGoods
public async Task<IActionResult> SpecialIndex()
{
ViewBag.Categories = await _context.Categories.AsNoTracking().ToListAsync().ConfigureAwait(false);
return View(await _context.Goods.Where(s => s.IsSpecial.GetValueOrDefault() == (int)EnumCode.yesno.是).OrderBy(s => s.SortNo).AsNoTracking().ToListAsync().ConfigureAwait(false));
}
// GET: Goods
public async Task<IActionResult> Index()
{
ViewBag.Categories = await _context.Categories.AsNoTracking().ToListAsync().ConfigureAwait(false);
return View(await _context.Goods.Where(s => s.IsSpecial.GetValueOrDefault() == (int)EnumCode.yesno.否).OrderBy(s => s.SortNo).AsNoTracking().ToListAsync().ConfigureAwait(false));
}
// GET: Goods/Details/5
public async Task<IActionResult> Details(int? id)
{
if (id == null)
{
return NotFound();
}
var goodsEntity = await _context.Goods
.FirstOrDefaultAsync(m => m.Id == id);
if (goodsEntity == null)
{
return NotFound();
}
return View(goodsEntity);
}
后面还有 742 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。