// GET: ADMIN/Sach/Create public ActionResult Create() { var dao1 = new TacGiaFunction().TGs.Where(p => p.Tentacgia != null); ViewBag.TacgiaID = new SelectList(dao1, "TacgiaID", "tentacgia", null); var dao2 = new TheLoaiFunction().TLs.Where(p => p.Tentheloai != null); ViewBag.TheloaiID = new SelectList(dao2, "TheloaiID", "tentheloai", null); var dao3 = new NhaXuatBanFunction().NXBs.Where(p => p.TenNXB != null); ViewBag.NhaxuatbanID = new SelectList(dao3, "NhaxuatbanID", "tennxb", null); return(View()); }
// GET: ADMIN/Sach/Edit/5 public ActionResult Edit(int id) { var dao1 = new TacGiaFunction().TGs.Where(p => p.Tentacgia != null); ViewBag.TacgiaID = new SelectList(dao1, "TacgiaID", "tentacgia", null); var dao2 = new TheLoaiFunction().TLs.Where(p => p.Tentheloai != null); ViewBag.TheloaiID = new SelectList(dao2, "TheloaiID", "tentheloai", null); var dao3 = new NhaXuatBanFunction().NXBs.Where(p => p.TenNXB != null); ViewBag.NhaxuatbanID = new SelectList(dao3, "NhaxuatbanID", "tennxb", null); var model = new SachFunction().FindEntity(id); return(View(model)); }