Exemplo n.º 1
0
        public ActionResult SlideBar()
        {
            CategoryF categoryf          = new CategoryF();
            IEnumerable <Category> model = categoryf.accessDatabase;

            return(View(model));
        }
Exemplo n.º 2
0
        // GET: Product
        public ActionResult Index(int?GroupID, int?CategoryID, int?SupplierID, string search, int?page, int?NumberPage)
        {
            //  service.ListAll(
            List <Product> model = new ProductF().ProductSell.ToList();

            ViewBag.category   = CategoryID;
            ViewBag.Supplier   = SupplierID;
            ViewBag.group      = GroupID;
            ViewBag.numberpage = NumberPage;
            ViewBag.search     = search;

            if (CategoryID != null)
            {
                model = model.Where(p => p.IdCategories == CategoryID).ToList();
                Category category = new CategoryF().FindEntity(CategoryID.GetValueOrDefault(0));
                ViewBag.Parent = category.Name;
                ViewBag.ID     = CategoryID;
            }
            if (SupplierID != null)
            {
                model = model.Where(p => p.IdSuppnier == SupplierID).ToList();
                Supplier supplier = new SupplierF().FindEntity(SupplierID.GetValueOrDefault(0));
                ViewBag.Parent = supplier.Name;
                ViewBag.ID     = SupplierID;
            }
            if (GroupID != null)
            {
                List <Category> category = new CategoryF().Categorys.Where(p => p.IdGroup == GroupID).ToList();
                List <Product>  product  = new ProductF().ProductSell.ToList();
                model.Clear();
                foreach (var item in product)
                {
                    if (category.Exists(x => x.Id == item.IdCategories))
                    {
                        model.Add(new ProductF().FindEntity(item.Id));
                    }
                }

                ViewBag.Parent = new GroupF().FindEntity((int)GroupID).Name;
                ViewBag.ID     = GroupID;
            }
            if (search != null)
            {
                model = new ProductF().Products.Where(p => p.Name.Contains(search)).ToList();
                //model = client.ListAll().Where(p => p.Name.Contains(search)).ToList();
            }
            return(View(model.ToPagedList(page ?? 1, NumberPage ?? 6)));
        }
 public ActionResult ChinhSuaLoai(Category Cate)
 {
     if (ModelState.IsValid)
     {
         var  dao = new CategoryF();
         bool id  = dao.Update(Cate);
         if (id == true)
         {
             return(RedirectToAction("Loai", "QuanLySanPham"));
         }
         else
         {
             ModelState.AddModelError("", "Them loại không thành công");
         }
     }
     return(View("Loai"));
 }
        public ActionResult ThemLoai(Category Cate)
        {
            if (ModelState.IsValid)
            {
                var dao = new CategoryF();
                Cate.Id = -1;
                bool id = dao.Insert(Cate);
                if (id)
                {
                    return(RedirectToAction("Loai", "QuanLySanPham"));
                }
                else
                {
                    ModelState.AddModelError("", "Them loại không thành công");
                }
            }
            ViewBag.Nhom = db.Groups.ToList();
            var L = db.Categories.ToList();

            return(View("Loai", L));
        }
Exemplo n.º 5
0
        public ActionResult LeftMenu()
        {
            var model = new CategoryF().ListCategory();

            return(PartialView("_PartialMenu", model));
        }
Exemplo n.º 6
0
        public ActionResult FooterMenu()
        {
            var model = new CategoryF().ListCategory();

            return(PartialView("_PartialFooter", model));
        }
Exemplo n.º 7
0
        public ActionResult SlideBar()
        {
            IEnumerable <Category> model = new CategoryF().accessDatabase;

            return(PartialView(model));
        }