// GET: Hang
        public ActionResult Index()
        {
            var hang  = HangDAL.createHangDAL();
            var model = hang.getAllHang();

            return(View(model));
        }
        public ActionResult DeleteConfirmed(int?id)
        {
            var hang = HangDAL.createHangDAL();

            hang.deleteHang(id);
            return(RedirectToAction("Index"));
        }
        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));
        }
Exemple #4
0
        public List <SelectListItem> GetHang()
        {
            List <SelectListItem> list = new List <SelectListItem>();
            var hang = HangDAL.createHangDAL();
            var han  = hang.getAllHang();

            foreach (var item in han)
            {
                list.Add(new SelectListItem {
                    Value = item.Id.ToString(), Text = item.Ten
                });
            }
            return(list);
        }
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }
            var hang  = HangDAL.createHangDAL();
            var hangx = hang.getHangById(id);

            if (hangx == null)
            {
                return(HttpNotFound());
            }
            return(View(hangx));
        }
 public ActionResult Edit(Hang model)
 {
     if (ModelState.IsValid)
     {
         var hang = HangDAL.createHangDAL();
         var id   = hang.updateHang(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 hang  = HangDAL.createHangDAL();
            var model = hang.detailHang(id);

            if (model == null)
            {
                return(HttpNotFound());
            }

            return(View(model));
        }
Exemple #8
0
 public HangBUS()
 {
     this.HangDAL = new HangDAL();
 }