Exemplo n.º 1
0
        public ActionResult Index(string search)
        {
            ProducLIst itemVM = new ProducLIst();

            if (search != null)
            {
                _search = search;
                string[]       keys = search.Split(' ');
                List <Product> list = new List <Product>();

                list          = _productServise.GetAll(x => x.Title.ToLower().Contains(keys[0].ToLower()));
                itemVM.Filter = new PruductFilter();
                if (keys.Length == 1)
                {
                    foreach (var item in list)
                    {
                        itemVM.Items.Add(item);
                    }
                }
                else
                {
                    itemVM = Check(keys, list, 1, itemVM);
                }

                return(View(itemVM));
            }

            return(View(itemVM));
        }
Exemplo n.º 2
0
        public ActionResult Delete(int id)
        {
            string controllerName = GetControlerName();

            if (controllerName == "BaseType")
            {
                ProductServise _product       = new ProductServise();
                var            elementID      = _typeServise.GetAll(x => x.BaseTypeID == id);
                var            productElement = _product.GetAll(x => x.Basetype == id);
                foreach (var item in productElement)
                {
                    item.Basetype = 0;
                    item.Type     = 0;
                    _product.Save(item);
                }
                foreach (var item in elementID)
                {
                    _typeServise.DeleteById(item.ID);
                }
            }
            _Servise.DeleteById(id);
            return(Redirect("../Index?Curentpage=1"));
        }
Exemplo n.º 3
0
 private ProducLIst PopulateIndex(ProducLIst itemVM)
 {
     itemVM.Items = _product.GetAll(x => x.Front == 1);
     return(itemVM);
 }