This repository has been archived on 2023-10-28. You can view files and clone it, but cannot push or open issues or pull requests.
pwt-0x01-ng/Controllers/ProductsController.cs
surtur c19a2963ec
All checks were successful
continuous-integration/drone/push Build is passing
chore: rm unnecessary using
2021-02-12 18:41:37 +01:00

27 lines
516 B
C#

using System.Linq;
using Microsoft.AspNetCore.Mvc;
using pwt_0x01_ng.Models;
using pwt_0x01_ng.Models.Database;
namespace pwt_0x01_ng.Controllers
{
public class ProductsController : Controller
{
readonly DBContext dbctx;
public ProductsController(DBContext dbctx){
this.dbctx = dbctx;
}
public IActionResult Detail(int id){
Product p = dbctx.Product.Where(p_item => p_item.id == id).FirstOrDefault();
if (p != null)
{
return View(p);
}
else
{
return NotFound();
}
}
}
}