Ejemplo n.º 1
0
        public Models.RecruiterJobSeeker.SearchResultModel PerformSearch(Models.User user, string keywords)
        {
            Models.RecruiterJobSeeker.SearchResultModel result = new Models.RecruiterJobSeeker.SearchResultModel(user, keywords);
            if (keywords != string.Empty)
            {
                if (user.UserType == 1)
                {
                    var dataContext = new Models.LinqModelHelperDataContext();
                    var dbusers = from u in dataContext.Users
                                 select u;

                    //result.Jobs.AddRange(dbjobs.Where(j => j.Description.ToUpper().Contains(keywords.ToUpper())));
                    foreach (Models.User u in dbusers)
                    {
                        //if (j.Description.ToUpper().Contains(keywords.ToUpper()) || j.Title.ToUpper().Contains(keywords.ToUpper()))
                        //{
                            result.Users.Add(u);
                        //}
                    }
                }
                else if (user.UserType == 2)
                {
                    var dataContext = new Models.LinqModelHelperDataContext();
                    var dbjobs = from j in dataContext.Jobs
                                 select j;

                    //result.Jobs.AddRange(dbjobs.Where(j => j.Description.ToUpper().Contains(keywords.ToUpper())));
                    foreach (Models.Job j in dbjobs)
                    {
                        if (j.Description.ToUpper().Contains(keywords.ToUpper()) || j.Title.ToUpper().Contains(keywords.ToUpper()))
                        {
                            result.Jobs.Add(j);
                        }
                    }
                }
            }
            return result;
        }
Ejemplo n.º 2
0
        public Models.RecruiterJobSeeker.SearchResultModel PerformSearchForJob(Guid recruiterID, Guid jobID)
        {
            var dataContext = new Models.LinqModelHelperDataContext();
            var dbjobs = from j in dataContext.Jobs
                         where j.JobID == jobID
                         select j;
            Models.Job job = dbjobs.First();
            Models.RecruiterJobSeeker.SearchResultModel result = new Models.RecruiterJobSeeker.SearchResultModel(recruiterID, job, String.Empty);

            var dbusers = from u in dataContext.Users
                          select u;

            //result.Jobs.AddRange(dbjobs.Where(j => j.Description.ToUpper().Contains(keywords.ToUpper())));
            foreach (Models.User u in dbusers)
            {
                //if (j.Description.ToUpper().Contains(keywords.ToUpper()) || j.Title.ToUpper().Contains(keywords.ToUpper()))
                //{
                result.Users.Add(u);
                //}
            }
            return result;
        }