예제 #1
0
        public void GetStringsBySpace()
        {
            string text = "ИВАНОВ ИВАН";

            string[] arrText = new[] { "ИВАНОВ", "ИВАН" };


            var result = HelpersFunction.GetStringsBySpace(text);

            Assert.AreEqual(arrText[0], result[0]);
            Assert.AreEqual(arrText[1], result[1]);
        }
예제 #2
0
파일: Repository.cs 프로젝트: irumil/Gnamr
        private static IEnumerable <Search> GetByNames(string text, FindModel param)
        {
            var name0 = HelpersFunction.GetStringsBySpace(text)[0];
            var name1 = HelpersFunction.GetStringsBySpace(text)[1];

            IQueryable <Search> result;

            if (param.MatchEndings)
            {
                result = Context.Search.Where(x => (x.firstname.Contains(name0) & x.lastname.Contains(name1))
                                              | (x.firstname.Contains(name1) & x.lastname.Contains(name0)));
            }
            else
            {
                result = Context.Search.
                         Where(x => (x.firstname == name0 & x.lastname == name1) | (x.firstname == name1 & x.lastname == name0));
            }
            return(result);
        }