Esempio n. 1
0
        public ActionResult DeleteConfirmed(int?id)
        {
            var nhomsp = NhomSanPhamDAL.createNhomSanPhamDAL();

            nhomsp.deleteNhomSP(id);
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        // 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));
        }
Esempio n. 4
0
        //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);
        }
Esempio n. 5
0
        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));
        }
Esempio n. 6
0
 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));
 }
Esempio n. 7
0
        //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));
        }