示例#1
0
        public ActionResult Delete(Synonym synonym, string languageId, string analyzer, string index)
        {
            List <Synonym> synonyms = _synonymRepository.GetSynonyms(languageId, index);

            synonyms.RemoveAll(s =>
            {
                string synonymFrom = synonym.From + (synonym.TwoWay ? null : "=>" + synonym.From);
                return(s.From == synonymFrom && s.To == synonym.To && s.TwoWay == synonym.TwoWay);
            });

            _synonymRepository.SetSynonyms(languageId, analyzer, synonyms, index);

            return(RedirectToAction("Index", new { index, languageId }));
        }
示例#2
0
        public ActionResult Delete(Synonym synonym, string languageId, string analyzer, string index)
        {
            List <Synonym> synonyms = _synonymRepository.GetSynonyms(languageId, index);

            synonyms.RemoveAll(s =>
            {
                string synonymFrom = String.Join(",", synonym.From
                                                 .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                                                 .Select(w => w.Trim()));

                if (!s.TwoWay && !s.MultiWord)
                {
                    synonymFrom += "=>" + synonymFrom;
                }

                return(s.From == synonymFrom && s.To == synonym.To && s.TwoWay == synonym.TwoWay && s.MultiWord == synonym.MultiWord);
            });

            _synonymRepository.SetSynonyms(languageId, analyzer, synonyms, index);

            return(RedirectToAction("Index", new { index, languageId }));
        }