public ActionResult ArayisEkle(decimal?UnitPriceMin, decimal?UnitPriceMax, int?m2Min, int?m2Max, string Nitelik, int?IlId, bool?Satilik, string Title) { filtre f = new filtre(); f.CreatedDate = DateTime.Now; f.DanismanId = CurrentUser.Id; f.IlId = IlId; f.m2Max = m2Max; f.m2Min = m2Min; f.Nitelik = Nitelik; f.Satilik = Satilik; f.Title = Title; f.UnitPriceMax = UnitPriceMax; f.UnitPriceMin = UnitPriceMin; db.filtres.Add(f); db.SaveChanges(); return(RedirectToAction("Arayislarim")); }
public ActionResult ArayisPortfoylerim(int id) { filtre f = db.filtres.Find(id); var p = db.portfoys.AsQueryable(); if (f.UnitPriceMin != null) { p = p.Where(x => x.Fiyat >= f.UnitPriceMin); } if (f.UnitPriceMax != null) { p = p.Where(x => x.Fiyat <= f.UnitPriceMax); } if (f.m2Min != null) { p = p.Where(x => x.M2 >= f.m2Min); } if (f.m2Max != null) { p = p.Where(x => x.M2 <= f.m2Max); } if (f.IlId != null) { p = p.Where(x => x.neighborhood.district.town.CityID == f.IlId); } if (f.Nitelik != "") { p = p.Where(x => x.IlanTipi == f.Nitelik); } if (f.Satilik != null) { p = p.Where(x => x.Satilik == f.Satilik); } return(View(p.Where(x => x.danisman.IsDeleted == false && x.IsDeleted == false && x.Onay == true && !x.islems.Any(y => y.IsDeleted == false && y.YonetimOnay == true) && x.BittiTarih > DateTime.Now).ToList())); }