示例#1
0
        public IEnumerable <Models.ResponseModels.Task.Task> GetTasksBasedOnApplicantSkills()
        {
            var user      = _commonService.GetCurrentUserContext();
            var skillList = new List <int>();

            if (user != null && user.SkillSet != null)
            {
                foreach (var skill in user.SkillSet)
                {
                    skillList.Add(skill.Id);
                }
                var dbtaskSkills     = _contributorRepository.GetTasksBasedOnApplicantSkills(skillList, user.UserId);
                var dbTaskApplicants = _contributorRepository.GetAppliedTasks(user.UserId);
                var tasks            = _taskSkillModelFactory.CreateModelList <Models.ResponseModels.Task.Task>(dbtaskSkills);
                //Map Applied field
                foreach (var appliedTask in dbTaskApplicants)
                {
                    var taskObj = tasks.Where(x => x.Id == appliedTask.TASK_ID).FirstOrDefault();
                    if (taskObj != null)
                    {
                        taskObj.IsApplied = true;
                    }
                }
                return(tasks);
            }
            return(null);
        }