Ejemplo n.º 1
0
        public void Get_By_Name()
        {
            string project_name_1 = "zyfei";
            string project_name_2 = "DBA";
            Project project_1 = new Project { Name = project_name_1 };
            Project project_2 = new Project { Name = project_name_2 };
            Project project_3 = new Project { Name = project_name_1 };

            IQueryable<Project> iqueryable = new List<Project> 
            {
                project_1,project_2,project_3
            }.AsQueryable();

            ProjectQuery query = new ProjectQuery(iqueryable);
            IList<Project> projects = query.GetByName(project_name_2).ToList();

            Assert.That(projects.Count, Is.EqualTo(1));
            Assert.That(projects.Contains(project_2));
        }
Ejemplo n.º 2
0
 public int GetByName(string name)
 {
     ProjectQuery query = new ProjectQuery(session.Query<Project>());
     Project project = query.GetByName(name).SingleOrDefault();
     return project == null ? 0 : project.Id;
 }
Ejemplo n.º 3
0
        public _SearchModel GetByPartialName(string projectName)
        {
            _SearchModel model = new _SearchModel();
            model.Projects = new List<_LiteralLinkedModel>();

            ProjectQuery query = new ProjectQuery(session.Query<Project>());
            IList<Project> queryProjects = query.GetByPartialName(projectName).ToList();
            foreach (Project project in queryProjects)
            {
                _LiteralLinkedModel item = new _LiteralLinkedModel();
                item.Filledby(project);
                model.Projects.Add(item);
            }

            return model;
        }