// GET: KategoriAltKategori
        public ActionResult Index(int? IlanId)
        {
            if (IlanId != null)
            {
                Query q = new Query();
                ViewBag.AltKategoriId = q.IlanIddenAltKategoriIdDon(IlanId.Value);
                ViewBag.KategoriId = q.AltKategoriIddenKategoriIdDon(ViewBag.AltKategoriId);
            }

            KategoriAltKategoriViewModel model = new KategoriAltKategoriViewModel();
            //model.AvailableKategoris.Add(new SelectListItem { Text = "-Kategori seçiniz-", Value = "0" });
            model.AvailableKategoris.Add(new SelectListItem { Text = "-Kategori seçiniz-", Value = "0" });
            KategoriAltKategori iss = new KategoriAltKategori();
            var Kategoris = iss.GetAllKategoris();
            foreach (var kategori in Kategoris)
            {
                model.AvailableKategoris.Add(new SelectListItem() { Text = kategori.KategoriAdi, Value = kategori.KategoriId.ToString() });
            }

            if (ViewBag.KategoriId != null)
            {
                model.KategoriId = ViewBag.KategoriId;
                var altKategoris = iss.GetAllAltKategorisByKategoriId(model.KategoriId);
                foreach (var altKategori in altKategoris)
                {
                    model.AvailableAltKategoris.Add(new SelectListItem() { Text = altKategori.AltKategoriAdi, Value = altKategori.Id.ToString() });
                }
                model.AltKategoriId = ViewBag.AltKategoriId;
            }
            return View(model);
        }
        // GET: MotMarkaModel
        public ActionResult Index(int? ModelId)
        {
            if (ModelId != null)
            {
                Query q = new Query();
                ViewBag.MotosikletModelId = q.Mot_MotorIddenMotModelIdDon(ModelId.Value);
                ViewBag.MotosikletMarkaId = q.Mot_ModelIddenMotMarkaIdDon(ViewBag.MotosikletModelId);
            }

            MotMarkaModelViewModel model = new MotMarkaModelViewModel();
            model.AvailableMotMarkas.Add(new SelectListItem { Text = "-Motosiklet markasını seçiniz-", Value = "0" });
            MotorMarkaModel iss = new MotorMarkaModel();
            var Markas = iss.GetAllMarkas();
            foreach (var marka in Markas)
            {
                model.AvailableMotMarkas.Add(new SelectListItem() { Text = marka.Marka, Value = marka.Id.ToString() });
            }

            if (ViewBag.MotosikletMarkaId != null )
            {
                model.MotMarkaId = ViewBag.MotosikletMarkaId;
                var MotModels=iss.GetAllModelsByMarkaId(model.MotMarkaId);
                foreach (var motModel in MotModels)
                {
                    model.AvailableMotModels.Add(new SelectListItem() { Text = motModel.Model, Value = motModel.Id.ToString() });
                }
                model.MotModelId = ViewBag.MotosikletModelId;
            }
            return View(model);
        }
示例#3
0
        // GET: IlIlce
        public ActionResult Index(int? IlanId)
        {
            if (IlanId != null)
            {
                Query q = new Query();
                ViewBag.IlanPostakutusuId = q.IlanIddenPostaKutusuIdDon(IlanId.Value);

                ObjectResult<sp_PKIlBaglantisi_Result> bak = q.pkIlBaglantisiniDon(ViewBag.IlanPostakutusuId);
                var bak2 = bak.First();
                ViewBag.IlanIlId = bak2.ilID;
                ViewBag.IlanIlceId = bak2.ilceID;
                ViewBag.IlanSemtId = bak2.semtID;
                ViewBag.IlanMahalleId = bak2.mahalleID;
                ViewBag.IlanPkId = bak2.pkID;
            }

            IlIlceViewModel model=new IlIlceViewModel();
            model.AvailableIls.Add(new SelectListItem{Text = "-İli seçiniz-",Value = "0"});
            IlceSemt iss  = new IlceSemt();
            var Ils = iss.GetAllIls();
            foreach (var Il in Ils)
            {
                model.AvailableIls.Add(new SelectListItem(){Text = Il.ad,Value = Il.ilID.ToString()});
            }

            if (ViewBag.IlanPostakutusuId != null)
            {
                //önce illeri doldur
                var Iller = iss.GetAllIls();
                foreach (var il in Iller)
                {
                    model.AvailableIls.Add(new SelectListItem() { Text = il.ad, Value = il.ilID.ToString() });
                }
                //ilçeleri doldur
                var Ilceler = iss.GetAllIlcesByIlId(ViewBag.IlanIlId);
                foreach (var oilce in Ilceler)
                {
                    model.AvailableIlces.Add(new SelectListItem() { Text = oilce.ad, Value = oilce.ilceID.ToString() });
                }

                //Semtleri doldur
                var Semtler = iss.GetAllSemtsByIlceId(ViewBag.IlanIlceId);
                foreach (var oSemt in Semtler)
                {
                    model.AvailableSemts.Add(new SelectListItem() { Text = oSemt.ad, Value = oSemt.semtID.ToString() });
                }

                //Mahalleleri doldur
                var Mahalleler = iss.GetAllMahallesByBySemtId(ViewBag.IlanSemtId);
                foreach (var oMahalleler in Mahalleler)
                {
                    model.AvailableMahalles.Add(new SelectListItem() { Text = oMahalleler.ad, Value = oMahalleler.mahalleID.ToString() });
                }

                //Mahalleleri doldur
                var PostaKodlari = iss.GetAllPostaKodsByByMahalleId(ViewBag.IlanMahalleId);
                foreach (var oPostaKodu in PostaKodlari)
                {
                    model.AvailablePostaKods.Add(new SelectListItem() { Text = oPostaKodu.kod.ToString(), Value = oPostaKodu.pkID.ToString()});
                }
                model.IlId = ViewBag.IlanIlId;
                model.IlceId = ViewBag.IlanIlceId;
                model.SemtId = ViewBag.IlanSemtId;
                model.MahalleId = ViewBag.IlanMahalleId;
                model.PostaKoduId = int.Parse(ViewBag.IlanPostakutusuId);

            }

            return View(model);
        }
示例#4
0
 public ActionResult motoE(int id)
 {
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     //mot_Motor mot_Motor = db.mot_Motor.Find(id);
     //if (mot_Motor == null)
     //{
     //    return HttpNotFound();
     //}
     ViewBag.index = 0;
     ViewBag.IlanId = id;
     Query q = new Query();
     ViewBag.MotosikletId = q.IlanIddenMotosikletIdDon(id);
     return View();
 }