public async Task <IActionResult> Edit([FromServices] TengoDbContext db, int id = 0) { if (id <= 0) { return(new NotFoundResult()); } var model = await service.Get(id); ViewData.Model = model; if (model == null) { return(new NotFoundResult()); } ViewBag.Category = await db.Category.ToListAsync(); return(View()); }
public async Task <IActionResult> Detail([FromServices] GoodsBLL service, int id = 0) { if (id <= 0) { return(new NotFoundResult()); } var model = await service.Get(id); if (model == null || model.Status != 1) { return(new NotFoundResult()); } ViewData.Model = model; ViewBag.RecGoods = await service.GetRecList(5); return(View()); }