public ActionResult DeleteConfirmed(int?id) { var nhomsp = NhomSanPhamDAL.createNhomSanPhamDAL(); nhomsp.deleteNhomSP(id); return(RedirectToAction("Index")); }
// GET: NhomSanPham public ActionResult Index() { var nhomsp = NhomSanPhamDAL.createNhomSanPhamDAL(); var model = nhomsp.getAllNhomSP(); return(View(model)); }
public ActionResult Index() { var nhomsp = NhomSanPhamDAL.createNhomSanPhamDAL(); var hang = HangDAL.createHangDAL(); var sp = SanPhamDAL.createSanPhamDAL(); ViewBag.NhomSP = nhomsp.getAllNhomSP(); ViewBag.Hang = hang.getAllHang(); ViewBag.SanPham = sp.getAllSanPham(); return(View(ViewBag)); }
//public List<SanPham> GetAllSanPham() //{ // //using (ApplicationDbContext db = new ApplicationDbContext()) // //{ // // return db.SanPhams.ToList<SanPham>(); // //} // //var sp = SanPhamDAL.createSanPhamDAL(); // //return sp.getAllSanPham(); // return db.SanPhams.ToList<SanPham>(); //} public List <SelectListItem> GetCategory() { List <SelectListItem> list = new List <SelectListItem>(); var nhomsp = NhomSanPhamDAL.createNhomSanPhamDAL(); var cat = nhomsp.getAllNhomSP(); foreach (var item in cat) { list.Add(new SelectListItem { Value = item.Id.ToString(), Text = item.Ten }); } return(list); }
public ActionResult Delete(int?id) { if (id == null) { return(HttpNotFound()); } var nhomsp = NhomSanPhamDAL.createNhomSanPhamDAL(); var category = nhomsp.getNhomSPById(id); if (category == null) { return(HttpNotFound()); } return(View(category)); }
public ActionResult Edit(NhomSanPham model) { if (ModelState.IsValid) { var nhomsp = NhomSanPhamDAL.createNhomSanPhamDAL(); var id = nhomsp.updateNhomSP(model); if (id == true) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "abc"); } } return(View(model)); }
//GET - DETAILS public ActionResult Detail(int?id) { if (id == null) { return(HttpNotFound()); } var nhomsp = NhomSanPhamDAL.createNhomSanPhamDAL(); var model = nhomsp.detailNhomSP(id); if (model == null) { return(HttpNotFound()); } return(View(model)); }