Пример #1
0
        public ActionResult Index()
        {
            var model = new F_House().DS_House.ToList();

            ViewBag.Host = new F_Host().DS_Host.ToList();
            return(View(model));
        }
Пример #2
0
        public ActionResult Agnetsingle(int id)
        {
            var    model = new F_House().DS_House.Where(x => x.HostID.Value == id).ToList();
            F_Host Host  = new F_Host();

            ViewBag.Host = Host.FindEntity(id);
            return(View(model));
        }
Пример #3
0
        public ActionResult Propertysingle(int id)
        {
            F_House House = new F_House();
            F_Host  Host  = new F_Host();

            ViewBag.House = House.FindEntity(id);
            ViewBag.Host  = Host.FindEntity(id);
            var model = new F_Image().DS_Image.Where(x => x.HouseID.Value == id).ToList();

            return(View(model));
        }
Пример #4
0
        public ActionResult F_Search(string Keyword, string Type, string City, string Bedrooms, string Garages, string Bathrooms, string Price)
        {
            var model = new List <House>();

            if (Type == "All Type")
            {
                if (City == "All City")
                {
                    model = new F_House().DS_House.Where(x => x.PropertyDescription.Contains(Keyword) || x.Location.Contains(Keyword) || x.PropertyType.Contains(Keyword)).ToList();
                }
                else
                {
                    model = new F_House().DS_House.Where(x => x.Location.Contains(City) && (x.PropertyDescription.Contains(Keyword) || x.Location.Contains(Keyword) || x.PropertyType.Contains(Keyword))).ToList();
                }
            }
            else
            {
                if (City == "All City")
                {
                    model = new F_House().DS_House.Where(x => x.PropertyType.Contains(Type) && (x.PropertyDescription.Contains(Keyword) || x.Location.Contains(Keyword) || x.PropertyType.Contains(Keyword))).ToList();
                }
                else
                {
                    model = new F_House().DS_House.Where(x => x.PropertyType.Contains(Type) && x.Location.Contains(City) && (x.PropertyDescription.Contains(Keyword) || x.Location.Contains(Keyword) || x.PropertyType.Contains(Keyword))).ToList();
                }
            }
            List <House> temp = new List <House>(model);
            int          Bed = 0, Bath = 0, Gar = 0;

            Int32.TryParse(Bedrooms, out Bed);
            Int32.TryParse(Bathrooms, out Bath);
            Int32.TryParse(Garages, out Gar);
            if (Bed > 0)
            {
                for (int i = 0; i < temp.Count; i++)
                {
                    if (temp[i].Beds != Bed)
                    {
                        temp.Remove(temp[i]);
                    }
                }
            }
            if (Bath > 0)
            {
                for (int i = 0; i < temp.Count; i++)
                {
                    if (temp[i].Baths != Bath)
                    {
                        temp.Remove(temp[i]);
                    }
                }
            }
            if (Gar > 0)
            {
                for (int i = 0; i < temp.Count; i++)
                {
                    if (temp[i].Garage != Gar)
                    {
                        temp.Remove(temp[i]);
                    }
                }
            }
            if (Price == "Below $100,000")
            {
                for (int i = 0; i < temp.Count; i++)
                {
                    if (temp[i].Price >= 100000)
                    {
                        temp.Remove(temp[i]);
                    }
                }
            }
            if (Price == "$100,000 - $250,000")
            {
                for (int i = 0; i < temp.Count; i++)
                {
                    if (temp[i].Price < 100000 || temp[i].Price >= 250000)
                    {
                        temp.Remove(temp[i]);
                    }
                }
            }
            if (Price == "$250,000 - $500,000")
            {
                for (int i = 0; i < temp.Count; i++)
                {
                    if (temp[i].Price < 250000 || temp[i].Price >= 500000)
                    {
                        temp.Remove(temp[i]);
                    }
                }
            }
            if (Price == "Over $500,000")
            {
                for (int i = 0; i < temp.Count; i++)
                {
                    if (temp[i].Price < 500000)
                    {
                        temp.Remove(temp[i]);
                    }
                }
            }
            ViewBag.Host = new F_Host().DS_Host.ToList();
            return(View("Index", temp));
        }
Пример #5
0
        public ActionResult Propertygrid()
        {
            var model = new F_House().DS_House.ToList();

            return(View(model));
        }