Mình bị lỗi model bị null trong view, và ko biết sửa như thế nào
Dưới đây là đoạn code bài của mình
Trong Controller
public ActionResult Details(string ma )
{
var model = new SanPham().FindEntity(ma);
return View(model);
}
Trong View
@model VietnamBikes.SANPHAM
@{
ViewBag.Title = "Details";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="content">
<div class="welcome">
<div class="container">
<div class="welcome-grids">
<div class="col-md-6 welcome-grid">
<img src="~/Content/images/@Model.URLAnh" class="img-responsive" alt="">
</div>
<div class="col-md-6 welcome-grid1">
<h2>@Model.TENSP</h2>
<h4>@Model.GIASP</h4>
Trong Model
[Table("SANPHAM")]
public partial class SANPHAM
{
[Key]
[StringLength(10)]
public string IDSP { get; set; }
[StringLength(10)]
public string IDHSX { get; set; }
[StringLength(10)]
public string IDLSP { get; set; }
[StringLength(30)]
public string TENSP { get; set; }
[StringLength(20)]
public string LOAISP { get; set; }
[StringLength(20)]
public string HANGSX { get; set; }
public int? GIASP { get; set; }
public string URLAnh { get; set; }
public string MOTA { get; set; }
public virtual HANGSX HANGSX1 { get; set; }
public virtual LOAISP LOAISP1 { get; set; }
}