Ejemplo n.º 1
0
        //отображение списка с объявлениями
        //type= тип объявления type2 тип квартиры

        public ActionResult list_ad(string type = "all", string type2 = "all-type", int pg = 1, int?Count_rooms = null)//,Search srch=null
        {
            // type2   gn kn zn
            //type sale lease


            list_ad_View res = new list_ad_View()
            {
                Current_page = pg, Type = type, Type2 = type2
            };

            res.srch.pg              = pg;
            res.srch.type            = type;
            res.srch.type2           = type2;
            res.srch.Count_rooms_bot = Count_rooms;
            res.srch.category        = "Квартиры";
            if (Count_rooms == 5)
            {
                res.srch.Count_rooms_top = null;
            }
            else
            {
                res.srch.Count_rooms_top = Count_rooms;
            }


            return(View(res));
        }
Ejemplo n.º 2
0
        public ActionResult Extended_search(Search a)
        {
            //тут принимает постом форма поиска и уже переход к конкретным листам с объявлениями
            //TO-DO что то очень похожее на метод Search

            switch (a.category)
            {
            case "Все типы":
                return(View());

            case "Квартиры":


                list_ad_View res = new list_ad_View()
                {
                    Current_page = a.pg, Type = a.type, Type2 = a.type2
                };
                res.srch = a.copy();
                return(View("list_ad", res));


            case "Телефоны":
                return(View());

            case "Животные":
                return(View());

            case "Машины":
                return(View());

            default:
                return(View());
            }
        }
Ejemplo n.º 3
0
        public ActionResult Extended_search_ajax_3_list_ad(Search srch)
        {
            //partial для ajax

            list_ad_View res = list_ad_ajax_1_function("", srch.ToString());

            return(PartialView("list_ad_ajax_1", res));
        }
Ejemplo n.º 4
0
        public ActionResult list_ad_ajax_1_1(string page = "", string search = null)
        {
            if (page == null)
            {
                page = "";
            }
            list_ad_View res = list_ad_ajax_1_function("page=" + page, search);

            return(PartialView("list_ad_ajax_1", res));
        }
Ejemplo n.º 5
0
        public ActionResult Search(string str, string category, string town)
        {
            Search srch = new Models.Search();

            srch.str      = str;
            srch.category = category;
            srch.town     = town;
            switch (category)
            {
            case "Все типы":
                return(View());

            case "Квартиры":


                list_ad_View res = new list_ad_View()
                {
                    Current_page = 1, Type = "all", Type2 = "all-type"
                };
                res.srch = srch;
                return(View("list_ad", res));


            case "Телефоны":
                return(View());

            case "Животные":
                return(View());

            case "Машины":
                return(View());

            default:
                return(View());
            }
        }
Ejemplo n.º 6
0
        public ActionResult list_ad_ajax_1(string filter = "", string search = null)
        {
            list_ad_View res = list_ad_ajax_1_function(filter, search);

            return(PartialView(res));
        }
Ejemplo n.º 7
0
        public list_ad_View list_ad_ajax_1_function(string filter = "", string search = null)
        {
            irr.Models.Search srch = irr.Models.Search.FromString(search);
            if (!string.IsNullOrEmpty(filter))
            {
                if (filter != "cancel")
                {
                    if (filter == "price")
                    {
                        if (srch.price_bool != null)
                        {
                            srch.pg         = 1;
                            srch.price_bool = !srch.price_bool;
                        }
                    }

                    if (filter == "rooms")
                    {
                        if (srch.rooms_bool != null)
                        {
                            srch.pg         = 1;
                            srch.rooms_bool = !srch.rooms_bool;
                        }
                    }
                    if (filter.IndexOf("page=") != -1)
                    {
                        try
                        {
                            string a = filter.Substring(5);//, filter.Length
                            int    b = Convert.ToInt32(a);
                            if (b < 1)
                            {
                                throw new System.InvalidOperationException("er+-");
                            }
                            srch.pg = b;
                        }
                        catch
                        {
                        }
                    }
                }
                else
                {
                    srch.pg         = 1;
                    srch.price_bool = null;
                    srch.rooms_bool = null;
                }
            }



            list_ad_View res = new list_ad_View()
            {
                Count_ad_on_page = srch.Count_ad_on_page, Type = srch.type, Type2 = srch.type2, Current_page = srch.pg
            };



            res.list = search_bd(srch);
            res.srch = srch.copy();



            if (true)
            {
                res.str.Add(1);
                int tmp = srch.pg - 2;
                tmp = tmp > 1 ? tmp : 2;

                for (int i = 1; i < 5 && tmp < srch.Count_page; ++i)
                {
                    res.str.Add(tmp);
                    ++tmp;
                }
            }
            if (srch.Count_page != 1)
            {
                res.str.Add(srch.Count_page);
            }

            res.Count_page = srch.Count_page;
            return(res);
        }