Ejemplo n.º 1
0
        public IActionResult Mobile()
        {
            List <MobileModel> list = new List <MobileModel>();

            if (search == null)
            {
                foreach (var item in System.IO.File.ReadAllLines("d:\\mobile.txt"))
                {
                    //1,1300000,山东,济南,中国联通,0531,250000
                    var data = item.Split(',');
                    list.Add(new MobileModel()
                    {
                        Prefix   = int.Parse(data[1]),
                        Proince  = data[2],
                        City     = data[3],
                        Vendor   = data[4],
                        AreaCode = data[5],
                        PostCode = data[6],
                    });
                }

                search = QuickSearch.BuildQuickSearch <MobileModel>(list.ToArray());
            }
            list = new List <MobileModel>();
            foreach (var item in "".Split(','))
            {
                var x = search.Search(new MobileModel()
                {
                    Prefix = int.Parse(item.Substring(0, 7))
                });
                if (x != null)
                {
                    list.Add(x);
                }
            }
            return(View(list));
        }