Beispiel #1
0
        public ActionResult Index(int id)
        {
            TypeBus.Xoa(id);
            var ds = TypeBus.DanhSach();

            return(View(ds));
        }
Beispiel #2
0
        public JsonResult Types()
        {
            var types = TypeBus.List();

            return(Json(new
            {
                data = types,
                status = true
            }, JsonRequestBehavior.AllowGet));
        }
Beispiel #3
0
        public async Task <Result <int> > AddLevel2([FromBody] TypeLevel2Ent ent)
        {
            Result <int> r = null;
            await Task.Run(() =>
            {
                r = ResultRunner <int> .Run(delegate() { TypeBus.AddLevel2(ent, LoggededInUserEmail); });
            });

            return(r);
        }
Beispiel #4
0
        public async Task <Result <List <TypeEnt> > > GetLevel2(int Level1_PK)
        {
            Result <List <TypeEnt> > r = null;
            await Task.Run(() =>
            {
                r = ResultRunner <List <TypeEnt> > .Run(delegate() { return(TypeBus.GetLevel2(Level1_PK)); });
            });

            return(r);
        }
        // GET: Admin/SanPham/Edit/5
        public ActionResult Edit(int id)
        {
            var ds        = ProductBus.ChiTiet(id);
            var selectnsx = ds.MaNSX;
            var selectlsp = ds.MaLSP;

            ViewBag.MaNSX = new SelectList(BrandBus.DanhSach(), "MaNSX", "TenNSX", selectnsx);
            ViewBag.MaLSP = new SelectList(TypeBus.DanhSach(), "MaLSP", "TenLSP", selectlsp);
            return(View(ds));
        }
Beispiel #6
0
 public ActionResult Edit(int id, loaisanpham lsp)
 {
     TypeBus.Sua(id, lsp);
     return(RedirectToAction("Index"));
 }
Beispiel #7
0
        // GET: Admin/Brand/Edit/5
        public ActionResult Edit(int id)
        {
            var ds = TypeBus.ChiTiet(id);

            return(View(ds));
        }
Beispiel #8
0
 public ActionResult Create(loaisanpham lsp)
 {
     lsp.bixoa = 0;
     TypeBus.Them(lsp);
     return(RedirectToAction("Index"));
 }
Beispiel #9
0
        // GET: Admin/Type
        public ActionResult Index()
        {
            var ds = TypeBus.DanhSach();

            return(View(ds));
        }
Beispiel #10
0
        // GET: Product/
        public ActionResult Index(int?BrandId, int?currentBrand, int?CateId, int?currentCate, int?TypeId, int?currentType, string currentFilter, string SearchString, int page = 1, int pageSize = 4)
        {
            ViewBag.BrandId = new SelectList(BrandBus.List(), "Id", "Name");
            ViewBag.CateId  = new SelectList(CategoryBus.List().Where(x => x.Status == true), "Id", "Name");
            ViewBag.TypeId  = new SelectList(TypeBus.List(), "Id", "Name");

            if (SearchString != null)
            {
                page = 1;
            }
            else
            {
                SearchString = currentFilter;
            }
            ViewBag.CurrentFilter = SearchString;

            if (CateId != null)
            {
                page = 1;
            }
            else
            {
                CateId = currentCate;
            }
            ViewBag.CurrentCate = CateId;

            if (TypeId != null)
            {
                page = 1;
            }
            else
            {
                TypeId = currentType;
            }
            ViewBag.CurrentType = TypeId;

            if (BrandId != null)
            {
                page = 1;
            }
            else
            {
                BrandId = currentBrand;
            }
            ViewBag.CurrentBrand = BrandId;

            var model = ProductBus.List().Where(x => x.Status == true);

            if (!string.IsNullOrEmpty(SearchString))
            {
                model = model.Where(x => x.Description.ToLower().Contains(SearchString.ToLower()) || x.Name.ToLower().Contains(SearchString.ToLower()));
            }
            if (BrandId != null)
            {
                model = model.Where(x => x.BrandId == BrandId);
            }

            ViewBag.CurrentBrand = BrandId;
            if (CateId != null)
            {
                model = model.Where(x => x.CateId == CateId);
            }
            if (TypeId != null)
            {
                model = model.Where(x => x.TypeId == TypeId);
            }
            return(View(model.ToPagedList(page, pageSize)));
        }
 // GET: Admin/SanPham/Create
 public ActionResult Create()
 {
     ViewBag.MaNSX = new SelectList(BrandBus.DanhSach(), "MaNSX", "TenNSX");
     ViewBag.MaLSP = new SelectList(TypeBus.DanhSach(), "MaLSP", "TenLSP");
     return(View());
 }