//for displaying the list of created item ,search result and i variable taken for displaying the page number at the bottom of the page
        public ActionResult List(string search, int?i)
        {
            if (Session["UserId"] != null)
            {
                SignupLoginEntities2 db = new SignupLoginEntities2();

                List <product> listemp = db.products.ToList();

                return(View(db.products.Where(x => x.product_name.StartsWith(search) || x.category_name.StartsWith(search) || search == null).ToList().ToPagedList(i ?? 1, 5)));
            }
            else
            {
                return(RedirectToAction("Index", "Login"));
            }
        }
        //for deleting the selected items
        public ActionResult DelSelected(String[] empids)
        {
            int[] getid = null;
            if (empids != null)
            {
                getid = new int[empids.Length];
                int j = 0;
                foreach (string i in empids)
                {
                    int.TryParse(i, out getid[j++]);
                }

                List <product>       getempids = new List <product>();
                SignupLoginEntities2 sd        = new SignupLoginEntities2();
                getempids = sd.products.Where(x => getid.Contains(x.Id)).ToList();
                foreach (var s in getempids)
                {
                    sd.products.Remove(s);
                }
                sd.SaveChanges();
            }
            return(RedirectToAction("List", "User"));
        }