public ActionResult AddProduct()
        {
            ViewBag.MainCat = new SelectList(mcr.SelectAll(), "Id", "Name", "00000000-3e66-4dba-99e3-d255f90080cd");
            var product         = new Product();
            var addProductModel = new AddOrUpdateProductModel();

            addProductModel.Product = product;
            return(View(addProductModel));
        }
Ejemplo n.º 2
0
        // GET: MainCategory
        public ActionResult _GetMainCategories()
        {
            MainCategoryRepository mcc = new MainCategoryRepository();
            var categories             = mcc.SelectAll();

            return(PartialView(categories));
        }
Ejemplo n.º 3
0
 public ActionResult Search(string search)
 {
     if (search != null)
     {
         ViewBag.Search = search;
         search         = search.ToLower().Trim();
         var products = pr.SelectAll().Where(i => i.Name.ToLower().Contains(search) || i.Brand.ToLower().Contains(search) || i.Model.ToLower().Contains(search) || i.Code.ToLower() == search).ToList();
         foreach (var mainCategory in mcr.SelectAll().Where(i => i.Name.ToLower().Contains(search)).ToList())
         {
             foreach (var subCategory in mainCategory.SubCategories)
             {
                 products.AddRange(subCategory.Products);
             }
         }
         foreach (var subCategory1 in scr.SelectAll().Where(i => i.Name.ToLower().Contains(search)).ToList())
         {
             products.AddRange(subCategory1.Products);
         }
         products = products.Distinct().ToList();
         return(View(products));
     }
     return(View("Index"));
 }
 public ActionResult Categories()
 {
     return(View(mcr.SelectAll()));
 }