예제 #1
0
        // GET api/values/5
        public List <string> Get(int id)
        {
            List <string> wordsResult = new List <string>();
            Predictive    predict     = new Predictive();

            LoadPrediction(predict);
            var searchTerm = id.ToString();
            var wordList   = predict.Search(searchTerm);

            foreach (var item in wordList)
            {
                wordsResult.Add(item);
            }

            return(wordsResult);
        }
        public ActionResult Index(FormCollection collection)
        {
            List <ResultModel> model   = new List <ResultModel>();
            Predictive         predict = new Predictive();

            LoadPrediction(predict);
            var searchTerm = collection["combination"];
            var wordList   = predict.Search(searchTerm);

            foreach (var item in wordList)
            {
                ResultModel rm = new ResultModel();
                rm.Search = Convert.ToInt32(searchTerm);
                rm.Words  = item;
                model.Add(rm);
            }

            return(View(model));
        }