コード例 #1
0
        public ActionResult Index(FormCollection form, ProjectSearchModel projectSearchModel)
        {
            var list = from project in _dbContext.Projects.ToList()
                       where (
                        (!String.IsNullOrEmpty(projectSearchModel.ProjectName) ?
                                project.ProjectName.Contains(projectSearchModel.ProjectName,
                                    StringComparison.OrdinalIgnoreCase) : true
                            ) &&
                            ((projectSearchModel.Id != default(int)) ?
                                projectSearchModel.Id == project.Id : true
                            )
                       )
                       select project;

            projectSearchModel.Projects = list;
            projectSearchModel.Queryables = GetQueryables();

            return View(projectSearchModel);
        }
コード例 #2
0
        // GET: Projects
        public ActionResult Index()
        {
            ProjectSearchModel projectSearchModel = new ProjectSearchModel();

            var list = from project in _dbContext.Projects.ToList()
                       select project;

            projectSearchModel.Projects = list;
            projectSearchModel.Queryables = GetQueryables();
            projectSearchModel.Id = default(int);

            return View(projectSearchModel);
        }