//Ürün Detayları
        public ActionResult UrunDetay(int?UrunID)
        {
            UrunEkleViewModel urunmodel = GetModel();
            List <urunler>    urunler   = db.urunler.Where(m => m.id == UrunID).ToList();

            if (urunler.Count > 0)
            {
                ViewBag.Urunler = urunler;
                return(View(urunmodel));
            }
            else
            {
                UrunAraViewModel model = new UrunAraViewModel();
                int pageIndex          = model.Page ?? 1;
                model.Urunler = (from cat in db.urunler.Where(f =>
                                                              (String.IsNullOrEmpty(model.UrunAdi) || f.UrunAdi.Contains(model.UrunAdi)) &&
                                                              (String.IsNullOrEmpty(model.UrunKodu) || f.UrunKodu.Contains(model.UrunKodu))
                                                              ).OrderBy(m => m.UrunAdi)

                                 select new UrunListModel
                {
                    UrunID = cat.id,
                    UrunKodu = cat.UrunKodu,
                    UrunResmi = cat.UrunResmi,
                    UrunAdi = cat.UrunAdi,
                    UrunFiyati = cat.UrunFiyati,
                    UrunStokAdeti = cat.UrunStokAdeti,
                    UrunOnayi = cat.UrunOnayi
                }
                                 ).ToPagedList(pageIndex, 2);
                return(View("Index", model));
            }
        }
        public ActionResult Index(UrunAraViewModel model, string state)
        {
            ViewBag.State = state;
            int pageIndex = model.Page ?? 1;

            model.Urunler = (from cat in db.urunler.Where(f =>
                                                          (String.IsNullOrEmpty(model.UrunAdi) || f.UrunAdi.Contains(model.UrunAdi)) &&
                                                          (String.IsNullOrEmpty(model.UrunKodu) || f.UrunKodu.Contains(model.UrunKodu))
                                                          ).OrderBy(m => m.UrunAdi)

                             select new UrunListModel
            {
                UrunID = cat.id,
                UrunKodu = cat.UrunKodu,
                UrunResmi = cat.UrunResmi,
                UrunAdi = cat.UrunAdi,
                UrunFiyati = cat.UrunFiyati,
                UrunStokAdeti = cat.UrunStokAdeti,
                UrunOnayi = cat.UrunOnayi
            }
                             ).ToPagedList(pageIndex, 2);
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_Urunler", model));
            }
            else
            {
                return(View(model));
            }
        }