public ActionResult ArsaListele(IlanSorgu filtre) { ViewBag.SorguDongu = filtre; ViewBag.Kullanici = ct.Kullanicis; ViewBag.ArsaTuru = ct.ArsaTurus; ViewBag.il = ct.illers; ViewBag.ilce = ct.ilcelers.Where(x => x.sehirId == filtre.il); var arsas = new List <Arsa>(); if (filtre.metrekare != null) //post olma durumu { var ars = from i in ct.Arsas select i; if (filtre.ilansahibi != 0) { ars = ars.Where(s => s.sahipId == filtre.ilansahibi); } if (filtre.ilanTuru != 0) { ars = ars.Where(s => s.arsaTuru == filtre.ilanTuru); } if (filtre.il != 0) { ars = from i in ars where i.il == filtre.il select i; } if (filtre.ilce != 0) { ars = from i in ars where i.ilce == filtre.ilce select i; } arsas = ars.ToList(); ViewBag.ArsaSayi = arsas.Count; } return(View(arsas)); }
public ActionResult IlanSorgula(IlanSorgu srg) { sorgu = srg; if (srg.ilanTuru == 1) { return(RedirectToAction("ListeKonutSorgu")); } else if (srg.ilanTuru == 2) { return(RedirectToAction("ListeIsyeriSorgu")); } else { return(RedirectToAction("ListeArsaSorgu")); } }
public ActionResult KonutListele(IlanSorgu filtre) { ViewBag.SorguDongu = filtre; ViewBag.Kullanici = ct.Kullanicis; ViewBag.KonutTuru = ct.KonutTurus; ViewBag.il = ct.illers; ViewBag.ilce = ct.ilcelers.Where(x => x.sehirId == filtre.il); ViewBag.isitmaTuru = ct.isitmaTurus; ViewBag.odasayisi = ct.odaSayisis; List <Konut> konuts = new List <Konut>(); if (filtre.metrekare != null) //post olma durumu { var knt = from i in ct.Konuts select i; if (filtre.ilansahibi != 0) { knt = knt.Where(s => s.sahipId == filtre.ilansahibi); } if (filtre.ilanTuru != 0) { knt = knt.Where(s => s.konutTuru == filtre.ilanTuru); } if (filtre.isitmaturu[0] != 0) { //knt = knt.Where(s => s.isitmaTuru == filtre.isitmaturu[0]); //Dizi mantığı desteklenmemekteymiş.. int isit = filtre.isitmaturu[0]; knt = from i in knt where i.isitmaTuru == isit select i; } if (filtre.odasayisi[0] != 0) { int odas = filtre.odasayisi[0]; knt = knt.Where(s => s.odaSayisi == odas); } if (filtre.il != 0) { knt = from i in knt where i.il == filtre.il select i; } if (filtre.ilce != 0) { knt = from i in knt where i.ilce == filtre.ilce select i; } konuts = knt.ToList(); ViewBag.KonutSayi = konuts.Count; } return(View(konuts)); }
public ActionResult IsyeriListele(IlanSorgu filtre) { ViewBag.SorguDongu = filtre; ViewBag.Kullanici = ct.Kullanicis; ViewBag.IsyeriTuru = ct.IsyeriTurus; ViewBag.il = ct.illers; ViewBag.ilce = ct.ilcelers.Where(x => x.sehirId == filtre.il); ViewBag.isitmaTuru = ct.isitmaTurus; ViewBag.odasayisi = ct.odaSayisis; List <Isyeri> isyeris = new List <Isyeri>(); if (filtre.metrekare != null) //post olma durumu { var isy = from i in ct.Isyeris select i; if (filtre.ilansahibi != 0) { isy = isy.Where(s => s.sahipId == filtre.ilansahibi); } if (filtre.ilanTuru != 0) { isy = isy.Where(s => s.isyeriTuru == filtre.ilanTuru); } if (filtre.isitmaturu[0] != 0) { int istma = filtre.isitmaturu[0]; isy = isy.Where(s => s.isitmaTuru == istma); } if (filtre.odasayisi[0] != 0) { int odas = filtre.odasayisi[0]; isy = isy.Where(s => s.odaSayisi == odas); } if (filtre.il != 0) { isy = from i in isy where i.il == filtre.il select i; } if (filtre.ilce != 0) { isy = from i in isy where i.ilce == filtre.ilce select i; } isyeris = isy.ToList(); ViewBag.IsyeriSayi = isyeris.Count; } return(View(isyeris)); }
public ActionResult KonutSorgula(IlanSorgu sorgu) { List <Konut> orginal = new List <Konut>(); if (sorgu.kategori == 0) { orginal = ct.Konuts.ToList(); } else { orginal = ct.Konuts.Where(x => x.kategori == sorgu.kategori).ToList(); } if (sorgu.konutturu != null) { List <Konut> temp = new List <Konut>(); foreach (int kt in sorgu.konutturu) { temp.AddRange(orginal.Where(x => x.konutTuru == kt)); } orginal = temp; } if (sorgu.il != 0) { orginal = orginal.Where(x => x.il == sorgu.il).ToList(); } if (sorgu.odasayisi != null) { List <Konut> temp = new List <Konut>(); foreach (int os in sorgu.odasayisi) { temp.AddRange(orginal.Where(x => x.odaSayisi == os)); } orginal = temp; } if (sorgu.isitmaturu != null) { List <Konut> temp = new List <Konut>(); foreach (int it in sorgu.isitmaturu) { temp.AddRange(orginal.Where(x => x.isitmaTuru == it)); } orginal = temp; } if (sorgu.fiyat != null) { if (sorgu.fiyat.Length == 1) { string olcu = sorgu.fiyat[0].Split('-')[0]; int deger = Convert.ToInt32(sorgu.fiyat[0].Split('-')[1]); if (olcu == "min") { orginal = orginal.Where(p => p.fiyat >= deger).ToList(); } else { orginal = orginal.Where(p => p.fiyat <= deger).ToList(); } } else { int deger1 = Convert.ToInt32(sorgu.fiyat[0].Split('-')[1]); int deger2 = Convert.ToInt32(sorgu.fiyat[1].Split('-')[1]); if (deger1 < deger2) { orginal = orginal.Where(p => p.fiyat > deger1 && p.fiyat < deger2).ToList(); } } } if (sorgu.metrekare != null) { if (sorgu.metrekare.Length == 1) { string olcu = sorgu.metrekare[0].Split('-')[0]; int deger = Convert.ToInt32(sorgu.metrekare[0].Split('-')[1]); if (olcu == "min") { orginal = orginal.Where(p => p.metrekare >= deger).ToList(); } else { orginal = orginal.Where(p => p.metrekare <= deger).ToList(); } } else { int deger1 = Convert.ToInt32(sorgu.metrekare[0].Split('-')[1]); int deger2 = Convert.ToInt32(sorgu.metrekare[1].Split('-')[1]); if (deger1 < deger2) { orginal = orginal.Where(p => p.metrekare >= deger1 && p.metrekare <= deger2).ToList(); } } } return(View(orginal)); }